Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(diagnostic): highlight hints, deprecated and unused text with their own unique hlgroups#3188

Merged
chemzqm merged 1 commit into
neoclide:masterfrom
dmitmel:master
Jul 2, 2021
Merged

fix(diagnostic): highlight hints, deprecated and unused text with their own unique hlgroups#3188
chemzqm merged 1 commit into
neoclide:masterfrom
dmitmel:master

Conversation

@dmitmel
Copy link
Copy Markdown
Contributor

@dmitmel dmitmel commented Jul 2, 2021

This PR fixes the remaining entries in DiagnosticHighlight to use unique hlgroups, namely Coc<Something>Highlight, instead of reusing existing ones. Note that I say "remaining" because that enum was using CocErrorHighlight and CocWarningHighlight from the beginning (commit df7a1d9, relevant code), then CocInfoFloat was correctly replaced with CocInfoHighlight in commit 4cd2b40, and finally I replace the remaining hlgroup for the "hint" severity with CocHintHighlight in this PR.

Additionally, I added the CocDeprecatedHighlight and CocUnusedHighlight groups for deprecated and unused code respectively, which link to CocStrikeThrough and CocFadeOut. This was done both for the sake of consistency, and future-proofing in case the CocStrikeThrough and CocFadeOut groups may come in handy for text formatting in other unrelated things, similarly to hlgroups such as CocBold, CocItalic, CocUnderline and others. Because the two new hlgroups are by default just linked, this will have no visible effect on user configurations.

As for CocHintHighlight, this PR indeed fixes highlighting of hints, which right now look like:

image

And here is how they will look after this PR (which was the behavior before commit df7a1d9):

image

As you can see, their highlighting of the relevant source code is now consistent with errors because by default all Coc*Highlight groups are linked to CocUnderline.

@chemzqm chemzqm merged commit 1866fc9 into neoclide:master Jul 2, 2021
chemzqm added a commit that referenced this pull request Jul 7, 2021
7089ffb refactor(semanticTokens): remove unnecessary lengend from provider
c92cc70 feat(semanticTokens): hanlde semanticTokens refresh request
dad735a fix(semanticTokensManager): use resolved provider of document
c6cbcbb refactor(highlight): improve highlight methods
50b1f98 chore(api): use getbufinfo for linecount
f43bee3 refactor(plugin): avoid wait extensions activated on initialize
720a5a7 chore(doc): fix link of README
31084ee perf(highlight): check exists highlights when possible
21f64bf docs(doc): doc of g:coc_text_prop_offset
1a7262c fix(tests): fix vim command test on CI
7b57d47 fix(handler): make codeLens.dispose (#3195)
d5eb44e fix(format): avoid unexpected cancel of format
3f8aa08 fix(handler): fix rename undefined
c0cc51d fix(source/file): add windows driver(X:\ or X:/) path support (#3189)
70b445b chore(handler): add more tests
e25d8fe chore(diagnostic): avoid unnecessary refresh
d62ad5b refactor(handler): split handler to different modules
0607abe chore(tsconfig): set noEmit to true
adefcb3 chore(typings): add missing methods of languages
3cd702c feat(highligher): add method addTexts
60ddea0 fix(diagnostic): avoid check equality of diagnostics
894616a docs(doc): doc of g:coc_service_initialized
4817390 chore(package): upgrade typescript
7c61968 feat(typings): more typings (#3187)
7051352 refactor(types): simplify types and exports
1866fc9 fix(diagnostic): highlight hints, deprecated and unused text with their own unique hlgroups (#3188)
0aa97ad refactor(handler): use locations handler
0a60275 refactor(handler): use hover handler
4e5a59b refactor(handler): use hover handler
6e7b735 refactor(highlights): avoid unnecessary try catch
66c6f9d fix(document): check latest insert for change
3874573 chore(handler): add more tests for search and highlights
8d14a34 chore(test): improve signature tests
f2b0f5d refactor(handler): improve documentHighlight handler
2ab3951 fix(float): disable fold for float windows
52140a7 refactor(codeActions): improve tests of codeActions
2a53fce fix(signature): use start position from coc_last_placeholder
6bc3ee0 test(handler): add semanticTokens tests (#3182)
77ecd7f fix(language-client): missed logs (#3183)
d88f985 refactor(handler): move colors related to colors module
c50a030 chore(codeActions): add more tests
ace2582 chore(signature): add more tests
@oblitum
Copy link
Copy Markdown
Member

oblitum commented Nov 19, 2021

@fannheyward do you think it's a good idea to associate this to SemanticTokenModifiers.deprecated? I've noticed deprecated strikethrough APIs due to diagnostics, it's quite useful, but some language servers are only providing it at semantic token side solely, not diagnostic. gopls seems to support this both through semantic token modifier and completion item tag:

rust-analyzer also seem to support this through semantic token, but sadly, I tried both coc-rust-analyzer and coc-go to no avail. I've checked their semantic tokens response in the verbose output and the deprecated modifier was never present, I don't understand why, not sure that's a bug in coc.nvim's semantic tokens.

Anyway, back to the topic, I suspect a reasonable deprecated semantic token modifier implementation would be (given use-ts-hi-group), that it picked CocDeprecatedHighlight in case TSDeprecated is empty/nonexistent, otherwise pick TSDeprecated.

@fannheyward
Copy link
Copy Markdown
Member

fannheyward commented Dec 10, 2021

that's a bug in coc.nvim's semantic tokens

@oblitum Yes, coc.nvim's semanticTokens didn't pick tokenModifiers by now. I'll take it this week.

@fannheyward
Copy link
Copy Markdown
Member

fannheyward commented Dec 15, 2021

@oblitum tokenModifiers has been handled in #3355, TSDeprecated will be highlighted.

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

Successfully merging this pull request may close these issues.

4 participants