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

LSP completion does not include any items when the cursor is in whitespace before an identifier #2672

Closed
Maistho opened this issue Jul 26, 2020 · 7 comments
Milestone

Comments

@Maistho
Copy link

Maistho commented Jul 26, 2020

It's the most visible inside flutter code, see example below.

The issue only occurs if dart.previewLsp is enabled in the settings.

return Container(
  // If I put my cursor on the first line and press ctrl+space I do not get any suggestions
  child: Text(“test”),
  // I also don't get any suggestions between two items
  color: Colors.red,
  // But, if there's a comma between my cursor and the next word, the suggestions appear
  ,
  alignment: Alignment.center,
);
@Maistho Maistho changed the title LSP doesn't consider newlines when suggesting completions LSP doesn't consider newlines when generating suggestions Jul 26, 2020
@DanTup
Copy link
Member

DanTup commented Jul 29, 2020

Can you clarify exactly where you have your cursor when invoking completion, and which items you expect to see (that show for non-LSP mode) that don't? I did some testing, but I couldn't find any differences in LSP/DAS modes. Thanks!

@RaviKavaiya
Copy link

@DanTup Same problem here.
Let me show the screenshots:

LSP: OFF

Screenshot 2020-07-30 at 9 23 09 AM
Here, as you can see, on line 8, I have a child parameter already set. My cursor is on line 7, still it shows suggestions for Container parameters. THIS IS AS EXPECTED.


LSP: ON

Screenshot 2020-07-30 at 9 21 47 AM
Now, the same example as above. You can see that there is no property suggested of Container. This is not expected.

The issue only comes when the cursor is at first line or in the middle...

I hope I could convince.

@DanTup
Copy link
Member

DanTup commented Jul 30, 2020

@RaviKavaiya perfect - I can reproduce now. Will take a look. Thanks!

@DanTup DanTup added this to the v3.14.0 milestone Jul 30, 2020
@DanTup DanTup added in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is bug labels Jul 30, 2020
@DanTup
Copy link
Member

DanTup commented Jul 30, 2020

I think I've figured this out. I've sent a change for review at https://dart-review.googlesource.com/c/sdk/+/156501/.

@DanTup DanTup changed the title LSP doesn't consider newlines when generating suggestions LSP completion does not include any items when the cursor is in whitespace before an identifier Jul 30, 2020
dart-bot pushed a commit to dart-lang/sdk that referenced this issue Jul 30, 2020
…he cursor

Bug: Dart-Code/Dart-Code#2672
Change-Id: I45ccc00990495ddd9fa8881d673a45bf6c4f82d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156501
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
@Maistho
Copy link
Author

Maistho commented Aug 7, 2020

I tried it again today since I saw that the patch had landed.

Using the latest master release of the flutter sdk, which has dart 2.10.0-3.0.dev. It seems like it works as expected now.

I guess it will be a while before it is rolled out fully on the stable/beta branches. Thanks for the fix :)

@RaviKavaiya
Copy link

Hi @DanTup 👋
This issue seems to be fixed on latest dev version. You can close...

Thanks.

@DanTup
Copy link
Member

DanTup commented Aug 10, 2020

Yep, this was fixed in dart-lang/sdk@38fa4ae. Thanks!

@DanTup DanTup closed this as completed Aug 10, 2020
@DanTup DanTup added fixed in lsp and removed in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is bug labels Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants