Skip to content
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

LSP interfere with indentation function #89

Open
sfavazza opened this issue Sep 7, 2024 · 1 comment
Open

LSP interfere with indentation function #89

sfavazza opened this issue Sep 7, 2024 · 1 comment

Comments

@sfavazza
Copy link

sfavazza commented Sep 7, 2024

I use spacemacs and in my configuration, both LSP-mode and Dockerfile mode are enabled when editing an image description file.

Issue: when indenting a line (no matter the content), the line get unconditionally indented by dockerfile-indent-offset spaces. Checking the dockerfile-indent-line-function function I discovered that the function does not recognize the faces anymore as they are overwritten by lsp-semantic-tokens-mode.

Proposed solution: as I could not find much info on how to detect whether a word is a keyword or a part of a comment (syntax-pps does not recognize the begging of a comment). I would think of the following possibility:

1 - check whether lsp-semantic-tokens-mode is active, temparirily disable it, check which kind of line are we in, re-enable lsp-semantic-tokens-mode and perform the indentation.

2 - leveraging the fact that the lsp-semantinc-tokens-mode assigns meaningfully names faces, we might check that a particular string is included in the names of the retrieved thing-at-point faces (e.g. lsp-face-semhl-keyword <-> font-lock-keyword-face) and apply indentation accordingly

3 - detect only comments delimiters and keyword via reg-exp and indent accordingly (trowing out the text face all together)

4 - ignore any mentioned solution and direct this issue to the spacemacs community (I guess this will require and advice-add approach)

Happy to contribute if help is needed.

@drewcsillag
Copy link
Collaborator

I honestly don't know enough about LSP-mode to know the right answer here. But contributions are welcome!

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

No branches or pull requests

2 participants