arduino / arduino-language-server

An Arduino Language Server based on Clangd to Arduino code autocompletion
GNU Affero General Public License v3.0
139 stars 16 forks source link

Language server doesn't work on newly created non-.ino files #93

Closed per1234 closed 2 years ago

per1234 commented 2 years ago

Describe the bug

When a tab is created for a .cpp, .c, or .h file, no language server capabilities work in it. It only starts working after closing and reopening the sketch or changing the board selection.

To Reproduce

  1. Open a sketch in the Arduino IDE.
  2. Click the downward pointing triangle button on the right side of the tab bar.
  3. Select "New Tab" from the menu.
  4. In the "Name for new file" field, type foo.cpp.
  5. Click the OK button.
  6. Add some code to the foo.cpp tab that should produce some reaction from the language server. For example, this code:
    asdf

    should produce a red squiggly underline. Note that there is no language server capabilities in the file.

  7. Close the sketch.
  8. Open the sketch again. Note that the language server capabilities are now working as expected in foo.cpp.

Expected behavior

Language Server capabilities work in all types of sketch code files from creation on.

Desktop

Additional context

The issue does not occur when using Arduino Language Server version 0.5.0-rc2

Logs: LSnew.zip