Skip to content

LSP interfere with indentation function #89

@sfavazza

Description

@sfavazza

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions