Skip to content

Adds emacs lsp docs. #46

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hypnoticOxbow
Copy link
Contributor

Adds documentation for setting up emacs and lsp for silver development.

@hypnoticOxbow hypnoticOxbow requested a review from remexre October 30, 2022 17:59

`LSP` has two components, the client and the server.

### Setting up LSP Server
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silver language server specific stuff that isn't specific to the emacs plugin should probably be a separate page that is linked here. Which I was intending to write at some point, but the steps for building the language server are a good start.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can move this to another page

Then, go to `silver/language-server/` and run `./build.sh` to build the language server. When it finishes
you should have a jar `/silver/language-server/launcher/target/launcher.jar`.

After that, make a script `silver-language-server`, put it in your `$PATH` somehow (I put it in `~/bin/`, where the other silver scripts are linked to), and put the following contents into it:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See our discussion on slack. If we do need this script it's probably okay to check it in to the Silver repo rather than telling people to create it. But having the JVM flags hardcoded here seems wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminds me, (I realize I asked about this earlier, but I forgot) can the jvm flags passed to start the language server jar just be the same as the jvm flags passed in as config options? Is there any advantage to setting different options for the lsp jar itself?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Jvm Args" config option in the VS code extension is just the flags it uses when starting the server jar - this setting is never queried by the server itself. I am suggesting doing something similar for emacs.

methods outlined here, one for vanilla emacs users, and one for users of [Doom Emacs](https://github.com/doomemacs/doomemacs/).


#### Vanilla Emacs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to check these in somewhere under support/emacs and link to them here rather than having people copy/paste from here.


```elisp
;; Assumes silver-mode is somewhere in your load-path
(require 'silver-mode)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this depend on silver-mode? That only provides somewhat outdated regex-based syntax highlighting which is mostly obsoleted by the language server?

I guess it maybe is better than nothing as a fall-back when the server is starting or the file has a syntax error.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I figured maybe it's helpful to still have some syntax highlighting if you have a syntax error.

We could drop the silver-mode stuff, but it does help to have a function like silver-mode so we fit the pattern for language plugins in emacs of having a language-name-mode function to start the language specific behavior and language-name-mode-hook to add additional functionality on startup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants