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

Fix activeParameter=-1 for jdtls #29

Merged
merged 1 commit into from
Feb 3, 2023

Conversation

mikehaertl
Copy link
Contributor

eclipse.jdt.ls often returns -1 for activeParamer. This seems to be in line with the LSP specs.

Current code only checks if activeParameter lies above the upper limit but not if its below.

Also see eclipse-jdtls/eclipse.jdt.ls#2434

@@ -99,7 +99,7 @@ source._item = function(self, signature, parameter_index)
parameter_index = (signature.activeParameter or parameter_index or 0) + 1

-- @see https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#signatureHelp
if #parameters < parameter_index then
if #parameters < parameter_index or parameter_index == 0 then
Copy link
Owner

Choose a reason for hiding this comment

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

Should it be or parameter_index < 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well parameter_index will be 0 if activeParameter == -1 (line 99 above) and this leads to empty items.

But how about parameter_index < 1? This would also catch any other negative value for activeParameter.

Copy link
Owner

Choose a reason for hiding this comment

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

Yes. I think it should be.
We should support other negative values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed.

@hrsh7th
Copy link
Owner

hrsh7th commented Feb 3, 2023

Thank you for your contribution.
I left a small comment. Could you please check it?

@mikehaertl mikehaertl force-pushed the fix-jdtls-signature-help branch from 924e6e8 to 3c3ff1f Compare February 3, 2023 11:12
@hrsh7th
Copy link
Owner

hrsh7th commented Feb 3, 2023

LGTM. Thank you!

@hrsh7th hrsh7th merged commit 3d8912e into hrsh7th:main Feb 3, 2023
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.

2 participants