-
Notifications
You must be signed in to change notification settings - Fork 24
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
lsp-dart-line-length stopped working on flutter 2.5 #120
Comments
I'll take a look at this, probably something related with dart sdk bump |
yeah, I confirmed the issue happens on dart 2.14.0 but not on dart 2.13.1. |
This is how lsp-dart is sending the [Trace - 10:24:29 AM] Sending response 'workspace/configuration - (1)'. Processing request took 0ms
Params: {
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"dart": {
"enableSdkFormatter": true,
"completeFunctionCalls": true,
"showTodos": null,
"lineLength": 100
}
}
]
}
|
There was a change recently to support per-workspace config. Are you able to capture the traffic (or use It should be falling back to the original workspace-level config when there's no folder config, but I wonder if something is going wrong. |
@ericdallo do you have the request that the server sent to you that this responds to? |
sure, the server request was: [Trace - 10:24:29 AM] Received request 'workspace/configuration - (1).
Params: {
"items": [
{
"section": "dart"
}
]
}
|
@ericdallo the "dart" in your response looks suspect. When I log from VS Code, I see a request from the server like this: {
"id": 1,
"method": "workspace/configuration",
"params": {
"items": [
{
"section": "dart"
}
]
},
"jsonrpc": "2.0"
} And VS Code responds like this (note there's no "dart" anywhere): {
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"lineLength": 160,
// ...
}
]
} Although the LSP spec doesn't seem to be very clear about this. |
@yyoncho can you help understand what is the probably expected behavior? |
I don't think the spec is very clear, but there is some discussion in microsoft/language-server-protocol#972 which I think matches the Dart/VS Code stuff above - that is if a server asks for If it seems like there are many editors/servers doing the opposite, we should probably ping on microsoft/language-server-protocol#972 and see if we can get concrete clarification (and if that means changing the server and/or VS Code LSP client, I'm happy to do that). |
@ericdallo makes sense |
I'm not sure why, but testing now, I can't get lsp-mode to return the configuration wrapped by a with dart SDK 2.13.1 [Trace - 12:20:07 PM] Received request 'workspace/configuration - (1).
Params: {
"items": [
{
"section": "dart"
}
]
}
[Trace - 12:20:07 PM] Sending response 'workspace/configuration - (1)'. Processing request took 0ms
Params: {
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"enableSdkFormatter": true,
"completeFunctionCalls": true,
"showTodos": null,
"lineLength": 120
}
]
} with dart SDK 2.15.0 [Trace - 12:26:48 PM] Received request 'workspace/configuration - (1).
Params: {
"items": [
{
"scopeUri": "file:///home/greg/dev/flutter_sample",
"section": "dart"
},
{
"section": "dart"
}
]
}
[Trace - 12:26:48 PM] Sending response 'workspace/configuration - (1)'. Processing request took 0ms
Params: {
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"enableSdkFormatter": true,
"completeFunctionCalls": true,
"showTodos": null,
"lineLength": 120
}
]
} It seems to me that the client is returning correctly, any thoughts @yyoncho ? |
We do unwrap and return the result by position (as you can see it is returning a vector). |
So can we say it's something that changed on the newest dart SDK @DanTup ? |
@ericdallo the last request/response posted above don't look right to me. The request is asking for two items:
But the response contains only one:
The items in the resulting array need to match up with the request:
The server will ignore the response if the number of items don't match the request: (It is a result of a Dart SDK change that we send a request for config for multiple items and didn't before, but I think the fix needs to be here, the change in the SDK doesn't seem like a bug - perhaps an error could be reported somewhere better, although I suspect this on't be a common bug once fixed here). |
I see, it makes sense to me indeed! |
The issue is in lsp-dart - it should not define custom handler |
Available on next 1.19.5 release @sysint64 |
I'm still stuck with non-working |
What's your |
@ericdallo Here it is
|
@laynor I just tested with latest flutter (2.8.0, dart 2.15.0) and latest lsp-dart |
@ericdallo Can confirm it's working 👍 |
Describe the bug
lsp-dart-line-length
stopped working on flutter 2.5. On version 2.2 it works fine.To Reproduce
Install flutter 2.5 and set the line length to 100 symbols;
format buffer with
lsp-format-buffer
The text was updated successfully, but these errors were encountered: