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)
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 thedockerfile-indent-line-function
function I discovered that the function does not recognize the faces anymore as they are overwritten bylsp-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-enablelsp-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 accordingly3 - 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.