earthly / earthly-emacs

Major mode for editing Earthly Earthfile
Mozilla Public License 2.0
18 stars 9 forks source link

AS doesn't get highlight when using with IMPORT #24

Open wingyplus opened 1 year ago

wingyplus commented 1 year ago

Consider example below:

Screenshot 2566-05-24 at 14 36 33

The AS keyword doesn't get highlight as a keyword.

Konubinix commented 4 days ago

For your information, if you use https://github.com/glehmann/earthlyls, it provides several LSP features, including so called semantic tokens, meaning that you can ask the lsp server to provide the highlighting feature (using lsp-semantic-tokens-mode).

At first, I planned to create pull requests in here to improve the highlighting feature, but on second though, a semantically backed highlighting provided by LSP looks more awesome to me.

wingyplus commented 4 days ago

Hi @Konubinix, the PR for the improvement is very welcome. :)

Konubinix commented 2 days ago

I'm not sure there is anything to do in earthly-emacs to deal with this.

My setup looks like this

(use-package lsp-mode :commands (lsp))

(defun konix/earthfile-mode-hook ()
  (setq indent-tabs-mode nil)
  (setq tab-width 4)
  (setq indent-line-function #'tab-to-tab-stop)
  (setq-local lsp-semantic-tokens-enable t)
  (lsp)
  )

(add-hook #'earthfile-mode-hook
          #'konix/earthfile-mode-hook)