typst-lsp
typst-lsp copied to clipboard
Semantic highlighting does not get enabled properly in newly created files
- Component:
- [ ] VSCode Extension
- [ ] VSCodium Extension
- [x] LSP (used with other editor)
- Extension version: N/A but see:
## versions
vim version: NVIM v0.9.0-dev-1092+gbc15b075d1
node version: v20.4.0
coc.nvim version: 0.0.82-master
coc.nvim directory: /home/jade/co/coc.nvim
term: alacritty
platform: linux
- LSP version: typst-lsp 0.7.1
- OS version and name: Arch Linux, typst-lsp from nixpkgs unstable
- [x] I am on the latest stable version of the extension/LSP.
- [x] I have searched the issues of this repo and believe that this is not a duplicate.
Issue
When I open a new buffer that was not present at initialization time and start typing into it, the semantic highlighting (possibly also completion) does not initialize in that buffer.
Specifically:
:sp new.typ, then I type #let foo = 2 into it.
I would expect to get highlighting but I do not.
Logs
In the logs below, the offending file is nyanya.typ.
Verbose LSP Trace
[Trace - 18:27:43.871] Sending request 'initialize - (0)'.
Params: {
"processId": 1967760,
"rootPath": "/home/jade/class/cpsc320",
"rootUri": "file:///home/jade/class/cpsc320",
"capabilities": {
"workspace": {
"applyEdit": true,
"workspaceEdit": {
"documentChanges": true,
"resourceOperations": [
"create",
"rename",
"delete"
],
"failureHandling": "undo",
"normalizesLineEndings": true,
"changeAnnotationSupport": {
"groupsOnLabel": false
}
},
"didChangeConfiguration": {
"dynamicRegistration": true
},
"didChangeWatchedFiles": {
"dynamicRegistration": true,
"relativePatternSupport": true
},
"codeLens": {
"refreshSupport": true
},
"executeCommand": {
"dynamicRegistration": true
},
"configuration": true,
"fileOperations": {
"dynamicRegistration": true,
"didCreate": true,
"didRename": true,
"didDelete": true,
"willCreate": true,
"willRename": true,
"willDelete": true
},
"semanticTokens": {
"refreshSupport": true
},
"inlayHint": {
"refreshSupport": true
},
"inlineValue": {
"refreshSupport": true
},
"diagnostics": {
"refreshSupport": true
},
"symbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"tagSupport": {
"valueSet": [
1
]
},
"resolveSupport": {
"properties": [
"location.range"
]
}
},
"workspaceFolders": true
},
"textDocument": {
"publishDiagnostics": {
"relatedInformation": true,
"versionSupport": true,
"tagSupport": {
"valueSet": [
1,
2
]
},
"codeDescriptionSupport": true,
"dataSupport": true
},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
},
"completion": {
"dynamicRegistration": true,
"contextSupport": true,
"completionItem": {
"snippetSupport": true,
"commitCharactersSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
],
"deprecatedSupport": true,
"preselectSupport": true,
"insertReplaceSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"resolveSupport": {
"properties": [
"documentation",
"detail",
"additionalTextEdits"
]
},
"labelDetailsSupport": true,
"insertTextModeSupport": {
"valueSet": [
1,
2
]
}
},
"completionItemKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
]
},
"insertTextMode": 2,
"completionList": {
"itemDefaults": [
"commitCharacters",
"editRange",
"insertTextFormat",
"insertTextMode"
]
}
},
"hover": {
"dynamicRegistration": true,
"contentFormat": [
"markdown",
"plaintext"
]
},
"signatureHelp": {
"dynamicRegistration": true,
"contextSupport": true,
"signatureInformation": {
"documentationFormat": [
"markdown",
"plaintext"
],
"activeParameterSupport": true,
"parameterInformation": {
"labelOffsetSupport": true
}
}
},
"references": {
"dynamicRegistration": true
},
"definition": {
"dynamicRegistration": true,
"linkSupport": true
},
"documentHighlight": {
"dynamicRegistration": true
},
"documentSymbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"hierarchicalDocumentSymbolSupport": true,
"tagSupport": {
"valueSet": [
1
]
},
"labelSupport": true
},
"codeAction": {
"dynamicRegistration": true,
"isPreferredSupport": true,
"disabledSupport": true,
"dataSupport": true,
"honorsChangeAnnotations": false,
"resolveSupport": {
"properties": [
"edit"
]
},
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"",
"quickfix",
"refactor",
"refactor.extract",
"refactor.inline",
"refactor.rewrite",
"source",
"source.organizeImports"
]
}
}
},
"codeLens": {
"dynamicRegistration": true
},
"formatting": {
"dynamicRegistration": true
},
"rangeFormatting": {
"dynamicRegistration": true
},
"onTypeFormatting": {
"dynamicRegistration": true
},
"rename": {
"dynamicRegistration": true,
"prepareSupport": true,
"honorsChangeAnnotations": true,
"prepareSupportDefaultBehavior": 1
},
"documentLink": {
"dynamicRegistration": true,
"tooltipSupport": true
},
"typeDefinition": {
"dynamicRegistration": true,
"linkSupport": true
},
"implementation": {
"dynamicRegistration": true,
"linkSupport": true
},
"declaration": {
"dynamicRegistration": true,
"linkSupport": true
},
"colorProvider": {
"dynamicRegistration": true
},
"foldingRange": {
"dynamicRegistration": true,
"rangeLimit": 5000,
"lineFoldingOnly": true,
"foldingRangeKind": {
"valueSet": [
"comment",
"imports",
"region"
]
},
"foldingRange": {
"collapsedText": false
}
},
"selectionRange": {
"dynamicRegistration": true
},
"callHierarchy": {
"dynamicRegistration": true
},
"linkedEditingRange": {
"dynamicRegistration": true
},
"semanticTokens": {
"dynamicRegistration": true,
"tokenTypes": [
"namespace",
"type",
"class",
"enum",
"interface",
"struct",
"typeParameter",
"parameter",
"variable",
"property",
"enumMember",
"event",
"function",
"method",
"macro",
"keyword",
"modifier",
"comment",
"string",
"number",
"regexp",
"decorator",
"operator"
],
"tokenModifiers": [
"declaration",
"definition",
"readonly",
"static",
"deprecated",
"abstract",
"async",
"modification",
"documentation",
"defaultLibrary"
],
"formats": [
"relative"
],
"requests": {
"range": true,
"full": {
"delta": true
}
},
"multilineTokenSupport": false,
"overlappingTokenSupport": false,
"serverCancelSupport": true,
"augmentsSyntaxTokens": true
},
"inlayHint": {
"dynamicRegistration": true,
"resolveSupport": {
"properties": [
"tooltip",
"textEdits",
"label.tooltip",
"label.location",
"label.command"
]
}
},
"inlineValue": {
"dynamicRegistration": true
},
"diagnostic": {
"dynamicRegistration": true,
"relatedDocumentSupport": true
},
"typeHierarchy": {
"dynamicRegistration": true
}
},
"window": {
"showMessage": {
"messageActionItem": {
"additionalPropertiesSupport": true
}
},
"showDocument": {
"support": true
},
"workDoneProgress": true
},
"general": {
"regularExpressions": {
"engine": "ECMAScript",
"version": "ES2020"
},
"markdown": {
"parser": "marked",
"version": "4.0.10"
},
"positionEncodings": [
"utf-16"
],
"staleRequestSupport": {
"cancel": true,
"retryOnContentModified": [
"textDocument/inlayHint",
"textDocument/semanticTokens/full",
"textDocument/semanticTokens/range",
"textDocument/semanticTokens/full/delta"
]
}
}
},
"initializationOptions": {},
"trace": "verbose",
"workspaceFolders": [
{
"uri": "file:///home/jade/class/cpsc320",
"name": "cpsc320"
},
{
"uri": "file:///home/jade/.dotfiles",
"name": ".dotfiles"
}
],
"locale": "en_CA",
"clientInfo": {
"name": "coc.nvim",
"version": "0.0.82"
}
}
[Trace - 18:27:44.088] Received notification 'window/logMessage'.
Params: {
"message": "Folder added to workspace: file:///home/jade/class/cpsc320",
"type": 3
}
[Info - 18:27:44.088] Folder added to workspace: file:///home/jade/class/cpsc320
[Trace - 18:27:44.088] Received notification 'window/logMessage'.
Params: {
"message": "Folder added to workspace: file:///home/jade/.dotfiles",
"type": 3
}
[Info - 18:27:44.088] Folder added to workspace: file:///home/jade/.dotfiles
[Trace - 18:27:44.089] Received response 'initialize - (0)' in 219ms.
Result: {
"capabilities": {
"completionProvider": {
"triggerCharacters": [
"#",
".",
"@"
]
},
"documentSymbolProvider": true,
"executeCommandProvider": {
"commands": [
"typst-lsp.doPdfExport",
"typst-lsp.doClearCache"
]
},
"hoverProvider": true,
"selectionRangeProvider": true,
"signatureHelpProvider": {
"triggerCharacters": [
"(",
","
]
},
"textDocumentSync": {
"change": 2,
"openClose": true,
"save": true
},
"workspaceSymbolProvider": true
}
}
[Trace - 18:27:44.089] Sending notification 'initialized'.
Params: {}
[Trace - 18:27:44.090] Sending notification 'workspace/didChangeConfiguration'.
Params: {
"settings": {}
}
[Trace - 18:27:44.090] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///home/jade/class/cpsc320/a1.typ",
"languageId": "typst",
"version": 1,
"text": "#import \"nya\"\n"
}
}
[Trace - 18:27:44.090] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///home/jade/class/cpsc320/nya.typ",
"languageId": "typst",
"version": 1,
"text": "#let nya = 2\n"
}
}
[Trace - 18:27:44.091] Received request 'client/registerCapability - (0)'.
Params: {
"registrations": [
{
"id": "semantic_tokens",
"method": "textDocument/semanticTokens",
"registerOptions": {
"full": {
"delta": true
},
"legend": {
"tokenModifiers": [
"strong",
"emph",
"math"
],
"tokenTypes": [
"comment",
"string",
"keyword",
"operator",
"number",
"function",
"decorator",
"bool",
"punct",
"escape",
"link",
"raw",
"label",
"ref",
"heading",
"marker",
"term",
"delim",
"pol",
"error",
"text"
]
}
}
}
]
}
[Trace - 18:27:44.091] Sending response 'client/registerCapability - (0)'. Processing request took 0ms
No result returned.
[Trace - 18:27:44.091] Received request 'workspace/configuration - (1)'.
Params: {
"items": [
{
"section": "typst-lsp.exportPdf"
},
{
"section": "typst-lsp.rootPath"
},
{
"section": "typst-lsp.semanticTokens"
}
]
}
[Trace - 18:27:44.092] Sending response 'workspace/configuration - (1)'. Processing request took 1ms
Result: [
null,
null,
null
]
[Trace - 18:27:44.092] Received request 'client/registerCapability - (2)'.
Params: {
"registrations": [
{
"id": "config",
"method": "workspace/didChangeConfiguration"
}
]
}
[Trace - 18:27:44.092] Sending response 'client/registerCapability - (2)'. Processing request took 0ms
No result returned.
[Trace - 18:27:44.092] Received request 'client/registerCapability - (3)'.
Params: {
"registrations": [
{
"id": "watch_typst_files",
"method": "workspace/didChangeWatchedFiles",
"registerOptions": {
"watchers": [
{
"globPattern": "**/*"
}
]
}
}
]
}
[Trace - 18:27:44.092] Sending response 'client/registerCapability - (3)'. Processing request took 0ms
No result returned.
[Trace - 18:27:44.093] Received notification 'window/logMessage'.
Params: {
"message": "server initialized!",
"type": 3
}
[Info - 18:27:44.093] server initialized!
[Trace - 18:27:44.699] Sending request 'textDocument/semanticTokens/full - (1)'.
Params: {
"textDocument": {
"uri": "file:///home/jade/class/cpsc320/a1.typ"
}
}
[Trace - 18:27:44.699] Received response 'textDocument/semanticTokens/full - (1)' in 0ms.
Result: {
"data": [
0,
0,
1,
2,
0,
0,
1,
6,
2,
0,
0,
6,
1,
20,
0,
0,
1,
5,
1,
0,
0,
5,
1,
20,
0
],
"resultId": "0"
}
[Trace - 18:27:48.126] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///home/jade/class/cpsc320/nyanya.typ",
"languageId": "typst",
"version": 1,
"text": "#let nya = 2\n\n\n"
}
}
[Trace - 18:27:48.225] Sending request 'textDocument/semanticTokens/full - (2)'.
Params: {
"textDocument": {
"uri": "file:///home/jade/class/cpsc320/nyanya.typ"
}
}