Skip to content

Fill in the lsp-mode section (and fix a typo) - #2

Open
lagenorhynque wants to merge 2 commits into
flix:masterfrom
lagenorhynque:add-lsp-mode-config-example
Open

Fill in the lsp-mode section (and fix a typo)#2
lagenorhynque wants to merge 2 commits into
flix:masterfrom
lagenorhynque:add-lsp-mode-config-example

Conversation

@lagenorhynque

Copy link
Copy Markdown
Contributor

This fills in the previously empty lsp-mode section of the README with a
working, verified configuration, mirroring the existing eglot one. It covers
the flix-mode setup, registering the Flix LSP client, semantic tokens, and the
working-directory advice needed so the server's project scan resolves
correctly.

The config is derived from my Spacemacs layer, reduced to a plain-Emacs
use-package setup, and verified on a clean Emacs 30 + Java 21 environment
(LSP starts, cross-file module resolution works, and semantic highlighting,
hover, and the Run code lens all function).

Also fixes a small typo: Use-package -> use-package in the eglot example.

One thing worth discussing: the example registers flix.toml with
project-find-functions so that plain Emacs recognizes the project root.
flix-mode resolves the compiler jar via project.el (project-current), and
without this registration project-current returns nil and jar resolution
fails. This likely affects the eglot setup too, since it goes through the same
flix-mode-server-path. It might make sense for flix-mode itself to register
flix.toml with project-find-functions at load time, so neither example
needs it -- happy to do that in a follow-up if you agree, @mdiin.

There's also room to go further later (e.g. wiring the "Run" code lens to a
REPL, as the Spacemacs layer does), but this keeps the example on par with the
eglot one for now.

Add a working lsp-mode setup to the previously empty lsp-mode section,
mirroring the existing eglot one: flix-mode setup, LSP client
registration, semantic tokens, the working-directory advice for the
server's relative-path project scan, and a project-find-functions entry
so plain Emacs recognizes flix.toml as a project root.
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.

1 participant