LSP configuring

382 views
Skip to first unread message

Jan Erik Moström

unread,
Aug 16, 2021, 4:20:39 AM8/16/21
to BBEdit Talk
I have the xcode command line tools installed (not the full Xcode
package) and apparently it includes a language server for the C language
family and Swift.

So today when I had to write some example code in C (long time since
that happened the last time) I got all kind of goodies showing up when
writing the program. Unfortunately I also get the a warning that
"~/Desktop/fib.c:1: 'stdio.h' file not found" for the line

# include <stdio.h>

What I can't figure out is how to tell bbedit/language server where this
file can be found.

How do I do this?

= jem

jj

unread,
Aug 16, 2021, 10:18:46 AM8/16/21
to BBEdit Talk
Hi Jan Erik,

Did you follow the instructions in https://www.barebones.com/support/bbedit/lsp-notes.html ?

They contain this recommendation:

However, at this writing we recommend that you not rely on the Xcode-bundled clangd, because it is out of date and has bugs that cause it to respond incorrectly to certain requests from BBEdit. Instead we recommend that you use "brew install llvm"" and then symlink /usr/local/opt/llvm/bin/clangd into BBEdit's "Language Servers" folder.

and in the Caveats section a recipe on how to create the required "compile_commands.json" compilation database.

HTH

Jean Jourdain

Rich Siegel

unread,
Aug 16, 2021, 10:19:28 AM8/16/21
to BBEdit Talk
I'll try and make some time some day soon to make a recipe; but
meanwhile, I would recommend reading <https://clangd.llvm.org/config> to
see how configuration files work for clangd.

However, I recommend that you install clangd newer than the one bundled
with Xcode. clangd 12.0.1 (as installed by "brew install llvm" and then
symlinked into BBEdit's "Language Servers" support folder) doesn't seem
to have any trouble finding the standard headers.

R.

--
Rich Siegel Bare Bones Software, Inc.
<sie...@barebones.com> <https://www.barebones.com/>

Someday I'll look back on all this and laugh... until they sedate me.

Jan Erik Moström

unread,
Aug 17, 2021, 1:19:26 AM8/17/21
to BBEdit Talk
On 16 Aug 2021, at 16:18, jj wrote:

> Did you follow the instructions
> in <https://www.barebones.com/support/bbedit/lsp-notes.html> ?

No, mostly because I didn't know that it was installed :D

= jem

Jan Erik Moström

unread,
Aug 17, 2021, 1:20:03 AM8/17/21
to BBEdit Talk
On 16 Aug 2021, at 16:19, Rich Siegel wrote:

> However, I recommend that you install clangd newer than the one
> bundled with Xcode. clangd 12.0.1 (as installed by "brew install llvm"
> and then symlinked into BBEdit's "Language Servers" support folder)
> doesn't seem to have any trouble finding the standard headers.

Thanks, I'll do this.

= jem

Edzard de Ranitz

unread,
Aug 27, 2021, 8:43:53 AM8/27/21
to BBEdit Talk
Greetings,

HTML LSP works fine. CSS does not seem to work. Never see the green dot. See brew config below.

% npm list -g --depth=0

/usr/local/lib

├── em...@2.3.4

├── n...@7.20.1

├── vscode-css-lan...@1.4.0

└── vscode-html-lan...@1.4.0

Anny suggestions?

Edz..

Message has been deleted

jj

unread,
Aug 27, 2021, 10:07:51 AM8/27/21
to BBEdit Talk
Hi Edzard,

As far as I know, the green dot in the language preferences means that BBEdit found an executable file with the name/path given in the "Command:" field of the Server pane. 

That doesn't imply the give executable is functional or even suitable.

Concerning the CSS LSP,  the vscode-css-languageserver-bin package creates a symlink named "css-languageserver" and BBEdit uses that as a default.

For whatever reason this symlink appears to use a relative path to the linked file and doesn't work.

    % ls -al `which css-languageserver`                
    lrwxr-xr-x  1 jj  admin  66 Aug 18 21:17 /usr/local/bin/css-languageserver -> ../lib/node_modules/vscode-css-languageserver-bin/cssServerMain.js

Try recreating this symlink with an absolute path (.

    % rm -i /usr/local/bin/css-languageserver
    % ln -fs <path_to_your_installed_node_modules>/vscode-css-languageserver-bin/cssServerMain.js /usr/local/bin/css-languageserver
    
HTH

Jean Jourdain

Rich Siegel

unread,
Aug 27, 2021, 10:17:33 AM8/27/21
to BBEdit Talk
On 27 Aug 2021, at 8:56, Edzard de Ranitz wrote:

> Note I see the green dot in the language prefrences with a green dot
> in the
> configuration window just never in the editor as started.

The navigation bar item indicates whether the server has returned any
issues in the file. If it is not present, then one (or possibly two) of
the following is the case:

- the language server is not running;

- the document does not exist on disk (e.g. an untitled never-saved
file); or

- the document was opened from a remote FTP/SFTP server (LSP is only
feasible for local files).
Reply all
Reply to author
Forward
0 new messages