Open michaelpj opened 3 years ago
FWIW I already have this customization:
'(haskell-pragma-face ((t (:inherit font-lock-preprocessor-face :foreground "royal blue"))))
So I think the underlying distinction is already being made.
Right, I meant to mention that: haskell-mode
does give them different font-lock highlighting already. I don't understand enough about how syntax processing in emacs works to know what bit would need to change for them not to look like comments (although here is what lsp-mode
does to distinguish comments: https://github.com/emacs-lsp/lsp-mode/blob/master/lsp-completion.el#L404).
This may be technically possible, but it seems like an indirect way to solve what is presumably an underlying issue with the LSP backend not completing very usefully inside comments.
Well, I'm not sure we'll ever get good completion inside comments. We probably just want to have it off. The problem is just that we can't distinguish that case from the weird case where we do want completions: pragmas. And I don't think we have enough context-sensitivity in how completions work in the LSP spec to notice whether or not we're in a comment...
You could be right, but on the other hand I'd be extremely surprised if the backend for lsp-java
doesn't intelligently complete javadoc comment tags like @property
, which I think would be similarly context-sensitive. I notice that that lsp-mode
backend enables completion-in-comments
.
The root of this issue is that for
lsp-mode
-based completions, we would like to complete language pragmas. Sincelsp-mode
is quite generic, we don't have a good way of saying this, and we just have to say that we want completion in all comments. That is often quite annoying (https://github.com/emacs-lsp/lsp-haskell/issues/135).@alanz made the suggestion that we could consider not treating pragmas as comments. I think that would mean a change to how
haskell-mode
tokenizes Haskell source, and ultimately I don't have a good sense of whether it would have lots of unintended consequences. But there is a certain logic to it: unlike normal comments, pragmas are active program elements that have a prescribed structure, and so in that sense are perhaps more like real syntax than comments.As I said, I don't really know if this is a good idea or not, so I'd appreciate some wisdom!