Skip to content

Commit b645a99

Browse files
authored
add doc and ci test for semantic tokens (#3938)
* add doc and ci test for semantic tokens * fix, semantic tokens test files, case sensitivity issue
1 parent b316b47 commit b645a99

File tree

6 files changed

+37
-3
lines changed

6 files changed

+37
-3
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ jobs:
240240
name: Test hls-overloaded-record-dot-plugin test suite
241241
run: cabal test hls-overloaded-record-dot-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-overloaded-record-dot-plugin --test-options="$TEST_OPTS"
242242

243+
- if: matrix.test
244+
name: Test hls-semantic-tokens-plugin test suite
245+
run: cabal test hls-semantic-tokens-plugin --test-options="$TEST_OPTS" || cabal test hls-semantic-tokens-plugin --test-options="$TEST_OPTS"
243246

244247

245248
test_post_job:

docs/features.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Many of these are standard LSP features, but a lot of special features are provi
2020
| [Code lenses](#code-lenses) | `textDocument/codeLens` |
2121
| [Selection range](#selection-range) | `textDocument/selectionRange` |
2222
| [Rename](#rename) | `textDocument/rename` |
23+
| [Semantic tokens](#semantic-tokens) | `textDocument/semanticTokens/full` |
2324

2425
The individual sections below also identify which [HLS plugin](./what-is-hls.md#hls-plugins) is responsible for providing the given functionality, which is useful if you want to raise an issue report or contribute!
2526
Additionally, not all plugins are supported on all versions of GHC, see the [plugin support page](./support/plugin-support.md) for details.
@@ -380,7 +381,15 @@ Known limitations:
380381

381382
- Cross-module renaming requires all components to be indexed, which sometimes causes [partial renames in multi-component projects](https://github.com/haskell/haskell-language-server/issues/2193).
382383

383-
### Rewrite to overloaded record syntax
384+
## Semantic tokens
385+
386+
Provided by: `hls-semantic-tokens-plugin`
387+
388+
Provides semantic tokens for each token to support semantic highlighting.
389+
390+
![Semantic Tokens Demo](https://private-user-images.githubusercontent.com/14073857/290981908-9619fae2-cb92-4d4e-b8f8-6507851ba9f3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDQ4MjgwODYsIm5iZiI6MTcwNDgyNzc4NiwicGF0aCI6Ii8xNDA3Mzg1Ny8yOTA5ODE5MDgtOTYxOWZhZTItY2I5Mi00ZDRlLWI4ZjgtNjUwNzg1MWJhOWYzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAxMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMTA5VDE5MTYyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBjOTUxNTM0ZDcyNmFmZjEyN2JlNzkwNWNjZjA4NTAzNDVkMzdlNmMxNDNiMzgxNGMzMTQ1NDRiMzUxZjM5OWQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.n-CL6e2R0TWHpmzVo1i60QEDczTEJ-8zvQWxjaBsnks)
391+
392+
## Rewrite to overloaded record syntax
384393

385394
Provided by: `hls-overloaded-record-dot-plugin`
386395

@@ -389,7 +398,8 @@ Code action kind: `refactor.rewrite`
389398
Rewrites record selectors to use overloaded dot syntax
390399

391400
![Explicit Wildcard Demo](../plugins/hls-overloaded-record-dot-plugin/example.gif)
392-
## Missing features
401+
402+
### Missing features
393403

394404
The following features are supported by the LSP specification but not implemented in HLS.
395405
Contributions welcome!
@@ -399,7 +409,6 @@ Contributions welcome!
399409
| Signature help | Unimplemented | `textDocument/signatureHelp` |
400410
| Jump to declaration | Unclear if useful | `textDocument/declaration` |
401411
| Jump to implementation | Unclear if useful | `textDocument/implementation` |
402-
| Semantic tokens | Unimplemented | `textDocument/semanticTokens` |
403412
| Linked editing | Unimplemented | `textDocument/linkedEditingRange` |
404413
| Document links | Unimplemented | `textDocument/documentLink` |
405414
| Document color | Unclear if useful | `textDocument/documentColor` |

docs/support/plugin-support.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ For example, a plugin to provide a formatter which has itself been abandoned has
6161
| `hls-rename-plugin` | 2 | 9.8 |
6262
| `hls-stylish-haskell-plugin` | 2 | 9.8 |
6363
| `hls-overloaded-record-dot-plugin` | 2 | |
64+
| `hls-semantic-tokens-plugin` | 2 | |
6465
| `hls-floskell-plugin` | 3 | 9.8 |
6566
| `hls-stan-plugin` | 3 | 9.2.(4-8) |
6667
| `hls-retrie-plugin` | 3 | 9.8 |
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{-# LANGUAGE TypeFamilies #-}
2+
module TDatafamily where
3+
4+
-- Declare a list-like data family
5+
data family XList a
6+
7+
-- Declare a list-like instance for Char
8+
data instance XList Char = XCons !Char !(XList Char) | XNil
9+
10+
-- Declare a number-like instance for ()
11+
data instance XList () = XListUnit !Int
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module TDataType where
2+
3+
data Foo = Foo Int deriving (Eq)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{-# LANGUAGE PatternSynonyms #-}
2+
module TPatternSyn where
3+
4+
5+
pattern Foo = 1
6+
7+

0 commit comments

Comments
 (0)