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

Cannot start new line from the end of a comment #219

Closed
aochagavia opened this issue Nov 8, 2018 · 4 comments
Closed

Cannot start new line from the end of a comment #219

aochagavia opened this issue Nov 8, 2018 · 4 comments

Comments

@aochagavia
Copy link
Contributor

To reproduce, start writing a comment like the one below and press enter.

// <|>

Expected behavior:

// 
// <|>

Actual behavior (enter is ignored)

// <|>
@kjeremy
Copy link
Contributor

kjeremy commented Nov 8, 2018

This may be because we don't specify a language configuration json file in the vscode extension's package.json.

See https://github.com/rust-lang-nursery/rls-vscode/blob/master/language-configuration.json as an example of what rls uses

@matklad
Copy link
Member

matklad commented Nov 8, 2018

This may be because we don't specify a language configuration json file in the vscode extension's package.json.

We ignore language configuration stuff and try to do all the things ourselves. This goes against how vscode typically work, but I think ultimately is the better approach: language configuration does not know about syntax, so it can go only so far. Compare, for example, how ra_lsp's extend selection and VS Code's build one works.

I believe this particular issue is caused by our on-enter handler here: https://github.com/rust-analyzer/rust-analyzer/blob/0952b928addce602bef9b671d7904033df39f632/crates/ra_analysis/src/lib.rs#L227-L231. In theory, it could be better than the built-in one, but in practice, I expect we have more bugs currently :)

@aochagavia
Copy link
Contributor Author

It looks like this was introduced by f8b36bb#diff-50177e66ffb4f631d05213c0adb0073d

The SourceChange object that is being sent from the language server does not match the interface we are using.

I guess this is a search and replace issue, where @matklad was replacing File by SourceFileNode or something like that

@aochagavia aochagavia mentioned this issue Nov 9, 2018
@matklad
Copy link
Member

matklad commented Nov 9, 2018

Excellent catch!

I wonder if we should have a test for this...

Seems tricky to write, because it's the VS Code which should be behind the wheel here (currently, we have zero tests for typescript code...)

bors bot added a commit that referenced this issue Nov 9, 2018
221: Fix on enter r=matklad a=aochagavia

Fixes #219

Co-authored-by: Adolfo Ochagavía <[email protected]>
@bors bors bot closed this as completed in #221 Nov 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants