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

Unexpected Diagnostic Positions #260

Closed
trajamsmith opened this issue May 23, 2020 · 4 comments
Closed

Unexpected Diagnostic Positions #260

trajamsmith opened this issue May 23, 2020 · 4 comments
Labels
Milestone

Comments

@trajamsmith
Copy link
Contributor

Hey again!

We're running into some strange unexpected behavior surrounding the diagnostic positions since upgrading our project's dependency from 0.4.0 -> 0.8.0 (I know it's a pretty big jump).

These are the expected diagnostic positions when using 0.4.0:
Screen Shot 2020-05-23 at 11 32 56 AM

Upgrading to 0.8.0, with no other changes at all, the diagnostic positions are no longer correct:
Screen Shot 2020-05-23 at 11 35 48 AM

I'm poking around the server locally trying to figure out why this might be the case.

For context, the content of the textDocument is: greetings:↵ hello:↵ hello:↵

@JPinkney
Copy link
Contributor

It looks like duplicate key for some reason is 1 line off. I think something in here:
https://github.com/redhat-developer/yaml-language-server/blob/master/src/languageservice/parser/yamlParser07.ts#L190-L205 is causing it

@trajamsmith
Copy link
Contributor Author

trajamsmith commented May 23, 2020

I think you're right, I think it's specifically something with the .filter().map() here:

const warnings = yamlDoc.errors.filter(e => (e.reason === duplicateKeyReason && isDuplicateAndNotMergeKey(e, text)) || e.isWarning).map(e => convertError(e));

I'll do some more poking around and open a PR if I find a fix — if that's alright with you @JPinkney. Thanks for the prompt response!

@JPinkney
Copy link
Contributor

@trajamsmith Yeah that works for me!

@trajamsmith
Copy link
Contributor Author

Should be fixed with the #261 merge.

@apupier apupier added this to the 0.9.0 milestone Jul 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants