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

"Failed to start language server" error when IDE installation path contains # #1124

Closed
3 tasks done
Wezz19 opened this issue Jun 28, 2022 · 16 comments · Fixed by #1811
Closed
3 tasks done

"Failed to start language server" error when IDE installation path contains # #1124

Wezz19 opened this issue Jun 28, 2022 · 16 comments · Fixed by #1811
Assignees
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself topic: language server Related to the Arduino Language Server type: imperfection Perceived defect in any part of project

Comments

@Wezz19
Copy link

Wezz19 commented Jun 28, 2022

Describe the problem

  • No splashscreen at start
  • Language server fails to start
  • The text in the editor has no colors (probably caused by the language server)

The IDE is otherwise working. Verify, upload and serial monitor works normally.

To reproduce

Place a '#' in the IDE folder name and start the IDE.

Expected behavior

If '#' in the IDE folder name can't be supported in Windows due to limited support in other OS's then a notification to the user should make it clear that the IDE folder name contains an unsupported symbol.

Otherwise since the IDE seems to be running normally except for the language server then maybe it can be fixed to support '#' symbols in windows at least.

Arduino IDE version

nightly-20220628

Operating system

Windows

Operating system version

10

Additional context

2022-06-28 11:53:12 root INFO [d044d6a1-4348-4d71-813b-f0efe4e7ed33] Start of 0 plugins: 203.1 ms [Finished 3.714 s after frontend start]
2022-06-28 11:53:12 root INFO Starting language server: arduino:avr:uno
2022-06-28 11:53:12 root INFO Failed to start language server for arduino:avr:uno
2022-06-28 11:53:12 root INFO Starting language server: arduino:avr:uno
2022-06-28 11:53:12 root INFO Failed to start language server for arduino:avr:uno
2022-06-28 11:53:12 root INFO Starting language server: arduino:avr:uno
2022-06-28 11:53:12 root INFO Failed to start language server for arduino:avr:uno
2022-06-28 11:53:12 root INFO Starting language server: arduino:avr:uno
2022-06-28 11:53:12 root INFO Failed to start language server for arduino:avr:uno
2022-06-28 11:53:12 root INFO Starting language server: arduino:avr:uno
2022-06-28 11:53:12 root INFO Failed to start language server for arduino:avr:uno
2022-06-28 11:53:12 root INFO Starting language server: arduino:avr:uno
2022-06-28 11:53:12 root INFO Failed to start language server for arduino:avr:uno
2022-06-28 11:53:13 root INFO Frontend application start: 2637.1 ms [Finished 6.808 s after backend start]

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details
@Wezz19 Wezz19 added the type: imperfection Perceived defect in any part of project label Jun 28, 2022
@per1234 per1234 added topic: code Related to content of the project itself topic: language server Related to the Arduino Language Server labels Jun 28, 2022
@per1234
Copy link
Contributor

per1234 commented Jun 28, 2022

Thanks for your report @Wezz19. I am able to reproduce the issue when using the Arduino IDE from such a path, but didn't have any problems when running Arduino Language Server directly from the command line with equivalent parameters. So this leads me to believe the issue is here in the Arduino IDE 2.x code base rather than in the Arduino Language Server code base.

@kittaakos
Copy link
Contributor

  • The text in the editor has no colors (probably caused by the language server)

No. Syntax coloring is done by TextMate and is unrelated to any language features.

@r3inbowari
Copy link
Contributor

This is caused by the theia-core module with incorrect assertion on Windows when the plugins path has a ‘#’.

@kittaakos
Copy link
Contributor

kittaakos commented Jan 9, 2023

Great instructions, thanks!

it can be fixed to support '#' symbols in windows at least.

It's not a Windows-specific problem. I can reproduce it on macOS.

This is caused by the theia-core module with incorrect assertion on Windows when the plugins path has a ‘#’.

There may be a different reason.

  1. From the logs, I can see that the Arduino VS Code extension starts:
PluginDeployerEntryImpl {
    originId: 'local-dir:../plugins',
    pluginId: 'vscode-arduino-tools',
    _type: 0,
    map: Map(1) { 'package.json' => [Object] },
    changes: [ 'PluginVsCodeDirectoryHandler' ],
    acceptedTypes: [ 1 ],
    currentPath: '/Users/a.kitta/dev/git/arduino-ide/plugins/vscode-arduino-tools/extension',
    initPath: '/Users/a.kitta/dev/git/arduino-ide/plugins/vscode-arduino-tools',
    resolved: true,
    resolvedByName: 'LocalDirectoryPluginDeployerResolver',
    _rootPath: '/Users/a.kitta/dev/git/arduino-ide/plugins/vscode-arduino-tools'
  },
  1. I also see the Building Sketch in the status bar when I edit the sketch in the editor. The status bar update comes from the Arduino language-server.
  2. The LS log files were generated as expected. Use "arduino.language.log": true in the settings.json and check the log files. You can even tail them.
1124.mp4

The LS works in other source files:

1124_02.mp4

@kittaakos
Copy link
Contributor

From the LS logs:

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-language-server4280496927/.clangd","diagnostics":[]}}Content-Length: 178

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///Users/a.kitta/Documents/Arduino/alma%23korte/alma%23korte.ino","version":1,"diagnostics":[]}}Content-Length: 112

{"jsonrpc":"2.0","id":1,"result":null,"error":{"code":-32603,"message":"-32001 Line value is out of range (2)"}}Content-Length: 36

This bug might belong to another issue tracker.

@kittaakos
Copy link
Contributor

kittaakos commented Jan 10, 2023

I can also see that the URI is incorrectly encoded. Maybe @cmaglie can advise:

V[08:48:25.483] ASTWorker running EnumerateTweaks on version 1 of /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-language-server4280496927/sketch/alma#korte.ino.cpp
I[08:48:25.483] --> reply:textDocument/codeAction("2") 86 ms, error: Line value is out of range (2)
V[08:48:25.483] >>> {"error":{"code":-32001,"message":"Line value is out of range (2)"},"id":"2","jsonrpc":"2.0"}

V[08:48:25.484] <<< {"id":"3","jsonrpc":"2.0","method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-language-server4280496927/sketch/alma#korte.ino.cpp"}}}

Here the URI must be

file:///private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-language-server4280496927/sketch/alma%23korte.ino.cpp

and NOT

file:///private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-language-server4280496927/sketch/alma#korte.ino.cpp

kittaakos pushed a commit to kittaakos/go-lsp that referenced this issue Jan 10, 2023
cmaglie added a commit to bugst/go-lsp that referenced this issue Jan 10, 2023
kittaakos pushed a commit that referenced this issue Jan 10, 2023
@kittaakos
Copy link
Contributor

  • The text in the editor has no colors (probably caused by the language server)

I could not reproduce this flaw. The rest is fixed: #1811

@Wezz19, could you please provide the steps to reproduce the syntax coloring problem?

@kittaakos kittaakos added the status: waiting for information More information must be provided before work can proceed label Jan 10, 2023
@Wezz19
Copy link
Author

Wezz19 commented Jan 10, 2023

@kittaakos What I meant with "no colors" is this:
Screenshot (127)
Here the IDE (zip version) is run from a path containing a #
"...\# Arduino IDE temp\arduino-ide_2.0.3_Windows_64bit\Arduino IDE.exe"

VS

here where the IDE (zip version) is run from a path with no special characters
"...\Arduino IDE temp\arduino-ide_2.0.3_Windows_64bit\Arduino IDE.exe"
Screenshot (129)

By the way, I think you forgot to edit the last line from your comment 8h ago. You probably meant this:

and NOT

file:///private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-language-server4280496927/sketch/alma#korte.ino.cpp

Not that it probably makes any difference anymore but just wanted to mention it =)

@kittaakos
Copy link
Contributor

What I meant with "no colors" is this:

Thanks for the prompt reply. I will check it on Windows. I did not see any issues with the coloring on macOS.


By the way, I think you forgot to edit the last line from your comment 8h ago. You probably meant this:

and NOT
file:///private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-language-server4280496927/sketch/alma#korte.ino.cpp

Not that it probably makes any difference anymore but just wanted to mention it =)

Nice catch. I update it. 👍

@kittaakos
Copy link
Contributor

I am still seeing errors on Windows.

This correctly works after the go-lsp fix:

{"jsonrpc":"2.0","id":1,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"file:///c%3A/Users/kittaakos/Documents/Arduino/min%23max/min%23max.ino"},"range":{"start":{"line":4,"character":2},"end":{"line":4,"character":2}},"context":{"diagnostics":[]}}}Content-Length: 170

{"jsonrpc":"2.0","id":2,"method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///c%3A/Users/kittaakos/Documents/Arduino/min%23max/min%23max.ino"}}}Content-Length: 40

{"jsonrpc":"2.0","id":"1","result":null}
>>>
Content-Length: 184

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///c%3A/Users/kittaakos/Documents/Arduino/min%23max/min%23max.ino","version":1,"diagnostics":[]}}
<<<
Content-Length: 40

{"jsonrpc":"2.0","id":"2","result":null}
>>>
Content-Length: 143

But the Arduino LS fails to publish the diagnostics from clagnd to IDE2. I do not yet know what's that, but the URI is not encoded, hence this is a bug:

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///C:/Users/kittaakos/AppData/Local/Temp/arduino-language-server3294049418/.clangd","diagnostics":[]}}Content-Length: 112

{"jsonrpc":"2.0","id":1,"result":null,"error":{"code":-32603,"message":"-32001 Line value is out of range (5)"}}Content-Length: 36

I will check it on Windows. I did not see any issues with the coloring on macOS.

I could not reproduce the coloring issue. I tend to split up this issue into two parts:

  • LS is not working if the main sketch file path contains a # due to incorrect URL path encoding,
  • syntax coloring is not working on Windows for whatever reason

@kittaakos kittaakos removed the status: waiting for information More information must be provided before work can proceed label Jan 11, 2023
kittaakos pushed a commit that referenced this issue Jan 11, 2023
@kittaakos
Copy link
Contributor

@Wezz19, could you please help us and try the tester build? I could reproduce the language server issues on both macOS and Windows. It's fixed, but I could not figure out what's causing the missing syntax coloring issue because I could not reproduce it. If you're willing to help, the PR is #1811, and you can find documentation about the beta testing here: https://github.com/arduino/arduino-ide/blob/main/docs/contributor-guide/beta-testing.md#beta-testing-guide. Thank you!

@Wezz19
Copy link
Author

Wezz19 commented Jan 11, 2023

Okay I tested the zip version on two computers and got the same result on both when I added a # in the path:
Screenshot (130)
One computer has win10 and the other a freshly installed win11 with no Arduino IDE installed

@kittaakos
Copy link
Contributor

kittaakos commented Jan 12, 2023

Thanks for the quick reply, @Wezz19.

I cannot reproduce it. The tester build works fine on my Windows machine when there is a # in the sketch path.

Apparently, you have some other issues. The screenshot from #1124 (comment) shows there is no # in the sketch path unless you have changed your sketchbook location (directories.user) too.

I would appreciate some info from you. If you have time, please share with us.

  • Please let me know where you installed IDE2 from the ZIP. What's the full filesystem path?
  • What does IDE2 show when you hover over the editor tab?
1124_02.mp4
  • What does IDE2 show in the browser's console? You can check it on Windows with Ctrl + Alt + I and save the logs.

1124_01

  • What are in the logs? Please open a CMD.exe and start IDE2 with "Arduino IDE.exe", close IDE2, and share the full log.
  • Does the language server works on your side? When selecting any board with an installed platform, do you see syntax errors in the editor?

@kittaakos kittaakos added the status: waiting for information More information must be provided before work can proceed label Jan 12, 2023
@kittaakos
Copy link
Contributor

kittaakos commented Jan 12, 2023

I cannot reproduce it.

Now, I can reproduce it. You have a # in the path to the IDE2 and not a # in the path to the sketch. (From here: #1124 (comment))

INFO Failed to start language server for arduino:samd:adafruit_circuitplayground_m0 Error: The command 'arduino.languageserver.start' cannot be executed. There are no active handlers available for the command.
    at p.executeCommand (file:///C:/Users/kittaakos/Desktop/%23%20ide2%201124/resources/app/lib/bundle.js:2:2272619)
    at h.startLanguageServer (file:///C:/Users/kittaakos/Desktop/%23%20ide2%201124/resources/app/lib/bundle.js:2:8033988)

@kittaakos
Copy link
Contributor

There are two separate issues here:

So this comment 👇 (#1124 (comment)) is also accurate and valuable. Thank you!

This is caused by the theia-core module with incorrect assertion on Windows when the plugins path has a ‘#’.

@kittaakos
Copy link
Contributor

I could not find any easy way to provide a workaround for this flaw in IDE2. See why: eclipse-theia/theia#12064 (comment).

I tend to split up this issue into two parts:

Here is the follow-up issue: #1815

#1811 fixes the bug when the sketch path contains a # and not IDE2 path has the #

kittaakos pushed a commit that referenced this issue Jan 16, 2023
@per1234 per1234 added the conclusion: resolved Issue was resolved label Jan 16, 2023
@per1234 per1234 changed the title Failed to start language server "Failed to start language server" error when IDE installation path contains # Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself topic: language server Related to the Arduino Language Server type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants