LSP tools is is a real useful tools when do development, not only VSCode, even for any editor which support it, e.g. emacs.
I use emacs for development rust
, go
, flutter
, even ruby(use solargraph as lsp server), tough, for ruby, the most useful function is auto format use rubocop.
autocompletion, auto format before save, see document when mouse hover, syntax check on compile time, those feature is quite impressed when i start work with those modern static-type language. even, when use DAP, this is possible to debug code use breakpoint from editor directly.
But i can’t make lucky work with crystalline, i even tried in VSCode, auto-completion not work in context.
e.g. as following screenshot, when i input plain_t, there is no completion with plain_text
appear.

- Following is my emacs config:
(setq lsp-clients-crystal-executable '("crystalline" "--stdio")) ;; run server with crystalline --stdio
(defun zw/lsp-crystal-common-hooks ()
(add-hook 'before-save-hook #'lsp-format-buffer t t)
(lsp-deferred) ;; start lsp when open crystal file use crystal-mode
)
(add-hook 'crystal-mode-hook 'zw/lsp-crystal-common-hooks)
- Following is diff for some changes to entry.
diff --git a/.crystalline_main.cr b/.crystalline_main.cr
new file mode 100644
index 0000000..dbfbb76
--- /dev/null
+++ b/.crystalline_main.cr
@@ -0,0 +1,2 @@
+require "./src/**"
+require "./lib/**"
diff --git a/shard.yml b/shard.yml
index 7bb70f6..7533865 100644
--- a/shard.yml
+++ b/shard.yml
@@ -8,6 +8,9 @@ targets:
app:
main: src/magpie_code_admin_cr.cr
+crystalline:
+ main: .crystalline_main.cr
+
crystal: 1.4.1
I consider lsp was started successful, but the editor was not work as expected, e.g. autocompletion, jump to definition, it seem like the only working part is, auto format code before save.
Any idea?