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

ALECodeAction fix: check linter name when searching for nearest error. #3901

Merged
merged 1 commit into from
Sep 16, 2021
Merged

ALECodeAction fix: check linter name when searching for nearest error. #3901

merged 1 commit into from
Sep 16, 2021

Conversation

daliusd
Copy link
Contributor

@daliusd daliusd commented Sep 14, 2021

It is easier to explain this fix with an example:

  • tsserver and LSPs ask for error information when you want to fix
    error. tsserver ts@getCodeFixes command needs tsserver error code.

  • now let's imagine that user has eslint and tsserver in use. Sometimes
    both can report same error in different way.

  • Now there is no guarantee which error will come first and if eslint
    error comes first then tsserver will not return code fixes as we are
    passing wrong error code to it.

This fix will return proper error code based on linter.

It is easier to explain this fix with an example:

* tsserver and LSPs ask for error information when you want to fix
  error. tsserver `ts@getCodeFixes` command needs tsserver error code.

* now let's imagine that user has eslint and tsserver in use. Sometimes
  both can report same error in different way.

* Now there is no guarantee which error will come first and if eslint
  error comes first then tsserver will not return code fixes as we are
  passing wrong error code to it.

This fix will return proper error code based on linter.
Copy link
Contributor

@hsanson hsanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a sensible check to do. Thanks for the fix.

@hsanson hsanson merged commit dca56dd into dense-analysis:master Sep 16, 2021
@daliusd
Copy link
Contributor Author

daliusd commented Sep 16, 2021

Looks like a sensible check to do. Thanks for the fix.

For some time I thought that I had misconfigured typescript until I figured out that I have left problem in this code. I think something similar can be done for LSP part as well.

@daliusd daliusd deleted the linter-name-fix branch September 16, 2021 13:08
@daliusd
Copy link
Contributor Author

daliusd commented Sep 16, 2021

🍻

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

Successfully merging this pull request may close these issues.

None yet

2 participants