Repository navigation
fix: using integer max value as line end indicator - #1169
Conversation
|
@mpeltonen thanks for your contribution. Your PR looks good but could you give some links about language server which uses that? |
|
This sounds like #584 and microsoft/vscode-languageserver-node#1574...? 🤔 |
Do you think this PR will fix the issue? |
|
Depends on where the fix is I guess. As you said previously in #584, LSP4J is choking on something so if the data is being "corrected" before sending it to LSP4J then it might fix it? Will have to see what @mpeltonen thinks after having a chance to review that issue maybe. |
|
I came across this when implementing IntelliJ plugin for Garmin's MonkeyC language server which is included in their ConnectIQ SDK and this is the only one I know for sure: https://developer.garmin.com/connect-iq/sdk/ Started wondering why some of the diagnostic notifications were not visible in IntelliJ's "Problems" view, and further investigation led to this. The "common pattern" is probably an overstatement and came from my discussions with ChatGPT about the issue. From ChatGPT:
|
|
Hmm, this might very well fix #584, but cannot be 100% sure. The crux of the problem/fix is that if the end position is Integer.MAX_VALUE, then in And there are more than one places like this in code: |
|
Thanks @mpeltonen ! Could you please:
|
|
Thanks for a great plugin! Will do those things after my plugin is in releasable state (and released)! 😎 |
|
Just to close the loop here, I updated from 0.14.0 to 0.14.3-20250705-112934 but I don't think it helped with #584. The server is sending this notification but I don't see the diagnostics in LSP4IJ. And to be clear again as aforementioned in #584 (comment), I recognize that servers should not be sending this value (as it is greater than the defined {
"uri": "file:///tmp/compose.yaml",
"version": 2,
"diagnostics": [
{
"range": {
"start": {
"line": 3,
"character": 6
},
"end": {
"line": 3,
"character": 4294967295
}
},
"severity": 1,
"source": "docker-language-server",
"message": "unexpected key name"
}
]
} |
|
Yeah, that is definitely a different case and I agree that that big of a value should not be sent by the server. |
Some LSP servers use Integer.MAX_VALUE as a special character position value to indicate "end of line" in position coordinates. LSPIJUtils.toOffset was not correctly handling this, which lead to for example received diagnostics notifications to be silently ignored.