elixir-lsp / elixir-ls

A frontend-independent IDE "smartness" server for Elixir. Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol"
https://elixir-lsp.github.io/elixir-ls/
Apache License 2.0
1.49k stars 196 forks source link

eex/heex file specific suggestions for if, case, cond etc. #786

Open benonymus opened 1 year ago

benonymus commented 1 year ago

Hey,

I have been using the atom https://github.com/elixir-editors/language-elixir package for years. Recently I have been looking at alternative editors,and using the language server.

I noticed that in the atom package there are "context" aware snippets, while in the language server based ones there aren't. In a .ex file you get regular if, else, case etc. and in .heex or other .eex files you get them with <%= =>. From here: https://github.com/elixir-editors/language-elixir/blob/dd18b5d712044edc0a6c68fadc5aaf2ef3ed7efc/snippets/language-elixir.cson#L162

I was wondering if that is omitted here on purpose? In every editor I tried the language server it offers the regular version in .eex files.

I looked around in the code here, and I see that we have special cases for |> for example.

Would it be possible to add the .eex variants where relevant?

Thank you

lukaszsamson commented 1 year ago

Sure we can accept a PR adding some new snippets. But the problem is a bit deeper. elixir_sense and elixirLS has no support for eex/heex syntax trees and is not aware of template and elixir context