Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing with folded code block is causing it to open #16864

Closed
DartBot opened this issue Feb 16, 2014 · 14 comments
Closed

Typing with folded code block is causing it to open #16864

DartBot opened this issue Feb 16, 2014 · 14 comments
Assignees
Labels
analyzer-recovery area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Feb 16, 2014

This issue was originally filed by LukeEChurc...@gmail.com


Enter the following code:

===

import 'dart:html';

void main() {
  querySelector("#sample_text_id")
    ..text = "Click me!"
    ..onClick.listen(reverseText);
}

void reverseText(MouseEvent event) {
  var text = querySelector("#sample_text_id").text;
  var buffer = new StringBuffer();
  for (int i = text.length - 1; i >= -1000; i--) {
    buffer.write(text[i]);
  }
  querySelector("#sample_text_id").text = buffer.toString();
}

====

Collapse the reverseText field

Navigate to between the methods, and slowly type void foo() { }, then delete it again

At some points when analysis is happening and showing new errors, the collapsed code is unfolding.

@clayberg
Copy link

Set owner to @scheglov.
Added this to the Later milestone.
Removed Priority-Medium label.
Added Priority-Low label.

@DartBot
Copy link
Author

DartBot commented Feb 16, 2014

This comment was originally written by LukeEC...@gmail.com


I don't think this should be low priority. it makes code folding really quite annoying to use.

@DartBot
Copy link
Author

DartBot commented Feb 16, 2014

This comment was originally written by LukeEC...@gmail.com


Removed Priority-Low label.
Added Priority-Medium label.

@clayberg
Copy link

This happens when deleting one character at a time and the right paren, ')', is deleted. That causes parser to show an error on the next method and expand it (probably because it considers it to be part of the proceeding fragment). Looks like a recoverability issue in the parser.

I believe this issue has probably been in the product since we first added cold folding, and this is the first I have seen it reported. It only shows up when deleting the right paren (with nothing following it on the same line), so the odds of encountering it are very low (and fall into the minor annoyance category). Thus the 'low' priority.

@DartBot
Copy link
Author

DartBot commented Feb 16, 2014

This comment was originally written by LukeEChur...@gmail.com


I understand.

I saw it happen in a number of other places as well when testing it. I can send a video if you like.

E.g. it also happens if you type "class d {" and pause.

There are some timing interleaves in which typing and deleting 'void ' are making it happen on my build as well.

I just checked in with a couple of other users now about 'any issues with code folding', they replied that it kept expanding and was annoying.

I think it's one of those things that is annoying but has never passed the thresholding of people reporting it, rather than being generally unhappy and saying things like 'typing is glitchy'.

@clayberg
Copy link

Konstantin - take a look at this and determine whether it is a code folding issue or parser issue. If it is a parser issue, assign to Brian. I suspect a parser issue as the Editor starts showing errors on the wrong lines when this happes.

@scheglov
Copy link
Contributor

When right parent, ')' is deleted, then this unit is parsed as the function "foo" with function-typed parameter "reverseText". This is logical, but then we cannot create a folding region for "reverseText" because there are no such top-level function anymore.

I think we could check in Parser if "reverseText" has a body and don't parse it as a function-typed parameter.


Attachment:
[Screen Shot 2014-02-16 at 1.47.21 PM.png](https://storage.googleapis.com/google-code-attachments/dart/issue-16864/comment-7/Screen Shot 2014-02-16 at 1.47.21 PM.png) (65.89 KB)


Set owner to @bwilkerson.

@clayberg
Copy link

Removed this from the Later milestone.
Added this to the 1.3 milestone.
Removed Area-Editor label.
Added Area-Analyzer label.

@bwilkerson
Copy link
Member

Removed this from the 1.3 milestone.
Added this to the Later milestone.
Added Analyzer-Recovery label.

@bwilkerson
Copy link
Member

Removed Type-Defect label.
Added Type-Enhancement label.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the Later milestone.
Added Oldschool-Milestone-Later label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-Later label.

@DartBot DartBot added Priority-Medium area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-recovery labels Aug 4, 2014
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug and removed triaged labels Mar 1, 2016
@srawlins
Copy link
Member

Is this bug still relevant? Does it happen in IntelliJ?

@bwilkerson
Copy link
Member

If it does, then it's an IntelliJ behavior that we don't control.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-recovery area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

7 participants