Commit Graph

17 Commits

Author SHA1 Message Date
Fangrui Song
9feab024f9 Support LSP semantic tokens
This patch implements `textDocument/semanticTokens/{full,range}`. If the
client supports semantic tokens, $ccls/publishSemanticHighlight (now
deprecated) is disabled.

These token modifiers are mostly useful to emphasize certain symbols:
`static, classScope, globalScope, namespaceScope`.

To enable a colorful syntax highlighting scheme, set the
highlight.rainbow initialization option to 10.
https://maskray.me/blog/2024-10-20-ccls-and-lsp-semantic-tokens

Note that the older $ccls/publishSemanticHighlight protocol with
highlight.lsRanges==true (used by vscode-ccls) is no longer supported.
2024-10-31 21:21:33 -07:00
Jan Lahoda
4ff22e6603
Making the progress an integer, as per the specification (#739) 2020-12-26 12:30:53 -08:00
Fangrui Song
5108cfafcb Report index status via $/progress
Add WorkDoneProgress to represent WorkDoneProgressBegin/WorkDoneProgressReport/WorkDoneProgressEnd.
2020-07-04 10:05:26 -07:00
Fangrui Song
61a1071634 💥 Rename FunctionName -> functionName, VarName -> var_name 2019-08-22 10:12:03 -07:00
Riatre Foo
3dac492025 Change RequestId::value from int to std::string to allow non-numeric IDs. 2019-07-16 14:39:35 +08:00
Fangrui Song
c728fe9795 project: support %cu directive and strip -M* options 2019-06-27 19:11:38 -07:00
Leszek Swirski
633d8936a8 Use DiagnosticRelatedInformation if client supports publishDiagnostics.relatedInformation (#276)
In clients that support DiagnosticRelatedInformation, display
clang notes as these nested diagnostics rather than appending
them to the parent diagnostic's message. Behaviour for clients
that don't support related information should be unchanged.
2019-02-21 02:23:21 +01:00
Fangrui Song
8835a555f8 Delay requests if the document has not not indexed (#176)
This fixes a plethora of "not indexed" errors when the document has not been indexed.

* Message handler throws NotIndexed if not overdue
* The message is put into backlog and tagged with backlog_path
* path2backlog[path] tracks backlog associated with document `path`
* The backlog is cleared when the index is merged
* backlog[0] is forced to run if it becomes overdue
2019-11-09 20:09:13 -08:00
Fangrui Song
49ae9e8912 Support textDocument/declaration & LocationLink
textDocument/{declaration,definition,typeDefinition} return either LocationLink[] or Location[]
Add an initialization option client.linkSupport . When it is false, ccls will return Location[] disregarding client's linkSupport.
`struct LocationLink` does not include originSelectionRange as it is wasteful.
2019-11-09 20:09:13 -08:00
Fangrui Song
a47fb42e30 Refactor serializer
Delete virtual bases Reader & Writer
Delete unused MAKE_REFLECT_STRUCT_WRITER_AS_ARRAY
Merge serializers/{json,binary}.hh into serializer.{hh,cc}
MAKE_REFLECT_STRUCT => REFLECT_STRUCT
MAKE_REFLECT_TYPE_PROXY => REFLECT_UNDERLYING
2019-11-09 20:09:13 -08:00
Fangrui Song
7f8f68c0b2 codeAction: use codeActionProvider: CodeActionOptions and respect CodeActionParams::range 2019-11-09 20:09:13 -08:00
Fangrui Song
741d8f2130 Refactor ReplyOnce; error if InitializeParams.rootUri is null 2019-11-09 20:09:13 -08:00
Fangrui Song
95bba3ed15 hierarchicalDocumentSymbol: support SymbolKind::Function declaration and uniquify by range
Also ensure selectionRange is a subrange of range, otherwise VSCode won't show the item.
Use detailed_name for 'detail'
2019-11-09 20:09:13 -08:00
Fangrui Song
09669fff76 Reduce MAKE_REFLECT_STRUCT in lsp.hh
Position -> Pos; lsPosition -> Position
2019-11-09 20:09:13 -08:00
Fangrui Song
0d4f4b68c0 Remove ls prefix from many LSP interfaces
Rename SymbolKind to Kind & lsSymbolKind to SymbolKind
Use textDocumentSync: TextDocumentSyncOptions
2019-11-09 20:09:13 -08:00
Fangrui Song
bbce333042 *.h -> *.hh 2019-11-09 20:09:13 -08:00
Fangrui Song
3cd0ee2fc7 Refactor message handler and namespace ccls 2019-11-09 20:09:11 -08:00