diff --git a/docs/examples/Module.cpp b/docs/examples/Module.cpp index 34a76016..470eb93f 100644 --- a/docs/examples/Module.cpp +++ b/docs/examples/Module.cpp @@ -1,5 +1,8 @@ #include +#include namespace clice { -} \ No newline at end of file + + +} diff --git a/docs/examples/Preprocessor.cpp b/docs/examples/Preprocessor.cpp index 2c3a1c83..7e4b3bad 100644 --- a/docs/examples/Preprocessor.cpp +++ b/docs/examples/Preprocessor.cpp @@ -88,6 +88,14 @@ int main(int argc, const char** argv) { } clang::Preprocessor& pp = instance->getPreprocessor(); + pp.setTokenWatcher([&pp](const clang::Token& token) { + if(!token.isAnnotation()) { + auto name = clang::Lexer::getSpelling(token, pp.getSourceManager(), pp.getLangOpts()); + llvm::outs() << "token: " << name << " kind: " << token.getName() << "\n"; + } else { + // TODO: split annoated token + } + }); // pp.addPPCallbacks(std::make_unique(pp)); clang::syntax::TokenCollector collector{pp}; diff --git a/include/Clang/Clang.h b/include/Clang/Clang.h index 16ee52fd..1458f55d 100644 --- a/include/Clang/Clang.h +++ b/include/Clang/Clang.h @@ -11,21 +11,9 @@ namespace clice { +using llvm::StringRef; + using clang::CompilerInstance; using clang::CompilerInvocation; -template -union uninitialized { - T value; - - uninitialized() {} - - ~uninitialized() { value.~T(); } - - template - auto& construct(Args&&... args) { - return *new (&value) T{std::forward(args)...}; - } -}; - } // namespace clice diff --git a/include/Clang/ParsedAST.h b/include/Clang/ParsedAST.h index ec026b46..a2171cd6 100644 --- a/include/Clang/ParsedAST.h +++ b/include/Clang/ParsedAST.h @@ -1,6 +1,6 @@ #pragma once -#include "Diagnostics.h" +#include "Diagnostic.h" #include "Preamble.h" #include "CompileDatabase.h" @@ -28,7 +28,7 @@ private: std::vector topLevelDecls; std::vector diagnostics; /// core members for clang frontend - uninitialized tokens; + // uninitialized tokens; clang::SyntaxOnlyAction action; CompilerInstance instance; @@ -41,7 +41,7 @@ public: const std::shared_ptr& invocation, const Preamble& preamble); - auto& Tokens() { return tokens.value; } + // auto& Tokens() { return tokens.value; } auto& Diagnostics() { return diagnostics; } diff --git a/include/LSP/Scheduler.h b/include/LSP/Scheduler.h index 18f9bc54..66b3b9cb 100644 --- a/include/LSP/Scheduler.h +++ b/include/LSP/Scheduler.h @@ -5,6 +5,12 @@ namespace clice { +struct TranslationUnit { + std::string path; + std::deque messages; + std::unique_ptr ast; +}; + /// a class used to manage all resources for the LSP server class Scheduler { private: diff --git a/include/LSP/Server.h b/include/LSP/Server.h index adce4f24..1fec494e 100644 --- a/include/LSP/Server.h +++ b/include/LSP/Server.h @@ -1,6 +1,6 @@ #pragma once -#include "Protocol.h" +#include #include "Scheduler.h" #include "Transport.h" @@ -11,9 +11,8 @@ extern class Server server; /// core class responsible for starting the server class Server { - uv_loop_t* loop; std::unique_ptr transport; - Scheduler scheduler; + std::unique_ptr scheduler; std::map methods; public: diff --git a/include/LSP/Transport.h b/include/LSP/Transport.h index 9b1f88d7..91e53985 100644 --- a/include/LSP/Transport.h +++ b/include/LSP/Transport.h @@ -4,7 +4,8 @@ namespace clice { -struct Transport { +class Transport { +public: virtual void send(std::string_view) = 0; virtual ~Transport() = default; }; diff --git a/include/Protocol/Basic.h b/include/Protocol/Basic.h index 9cf6e320..d0510827 100644 --- a/include/Protocol/Basic.h +++ b/include/Protocol/Basic.h @@ -1,7 +1,9 @@ #pragma once +#include #include #include +#include namespace clice::protocol { @@ -9,6 +11,9 @@ using Integer = int; using UInteger = unsigned int; using String = std::string; +template +struct Combine : Ts... {}; + class URI { private: String scheme; @@ -135,4 +140,28 @@ struct Diagnostic { // TODO: std::vector relatedInformation; }; +/// A parameter literal used in requests to pass a text document and a position inside that document. +struct TextDocumentPositionParams { + /// The text document. + TextDocumentIdentifier textDocument; + + /// The position inside the text document. + Position position; +}; + +using DocumentUri = String; + + + +// value set ['plaintext', 'markdown'] +using MarkupKind = String; + +struct MarkupContent { + /// The type of the Markup + MarkupKind kind; + + /// The content itself + String value; +}; + } // namespace clice::protocol diff --git a/include/Protocol/Capability.h b/include/Protocol/Capability.h deleted file mode 100644 index 5e27af58..00000000 --- a/include/Protocol/Capability.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#include - -namespace clice::protocol { - -} \ No newline at end of file diff --git a/include/Protocol/Document.h b/include/Protocol/Document.h deleted file mode 100644 index f55f4198..00000000 --- a/include/Protocol/Document.h +++ /dev/null @@ -1,47 +0,0 @@ -namespace clice::protocol { - -enum class SemanticTokenTypes { - Namespace, - Type, - Class, - Enum, - Interface, - Struct, - TypeParameter, - Parameter, - Variable, - Property, - EnumMember, - Event, - Function, - Method, - Macro, - Keyword, - Modifier, - Comment, - String, - Number, - Regexp, - Operator, - Decorator // @since 3.17.0 -}; - -enum SemanticTokenModifiers { - Declaration, - Definition, - Readonly, - Static, - Deprecated, - Abstract, - Async, - Modification, - Documentation, - DefaultLibrary -}; - -struct SemanticTokensLegend { - std::vector tokenTypes; - std::vector tokenModifiers; -}; - -}; // namespace clice diff --git a/include/Protocol/Language/CallHierarchy.h b/include/Protocol/Language/CallHierarchy.h new file mode 100644 index 00000000..1eae93bb --- /dev/null +++ b/include/Protocol/Language/CallHierarchy.h @@ -0,0 +1,90 @@ +#include "DocumentSymbol.h" + +namespace clice::protocol { + +/*=========================================================================/ +/ / +/============================= CallHierarchy ==============================/ +/ / +/=========================================================================*/ + +struct CallHierarchyItem { + /// The name of this item. + String name; + + /// The kind of this item. + SymbolKind kind; + + /// Tags for this item. + std::vector tags; + + /// More detail for this item, e.g. the signature of a function. + std::string detail; + + /// The resource identifier of this item. + URI uri; + + /// The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. + /// comments and code. + Range range; + + /// The range that should be selected and revealed when this symbol is being picked, e.g. the name of a + /// function. + Range selectionRange; + + /// A data entry field that is preserved between a call hierarchy prepare and incoming calls or outgoing + /// calls requests. std::any data; + /// data?: LSPAny; +}; + +/// Client Capability: +/// - property name (optional): `textDocument.callHierarchy` +/// - property type: `CallHierarchyClientCapabilities` defined as follows: +struct CallHierarchyClientCapabilities { + + /// Whether callHierarchy supports dynamic registration. + bool dynamicRegistration = false; +}; + +/// Request: +/// - method: 'textDocument/prepareCallHierarchy' +/// - params: `PrepareCallHierarchyParams` defined follows: +using CallHierarchyPrepareParams = Combine; + +/// Response: +/// - result: `CallHierarchyItem[]` +using CallHierarchyPrepareResult = std::vector; + +/*=========================================================================/ +/ / +/====================== Call Hierarchy Incoming Calls =====================/ +/ / +/=========================================================================*/ + +struct CallHierarchyIncomingCallsParamsBody { + /// The item for which incoming calls are to be computed. + CallHierarchyItem item; +}; + +/// Request: +/// - method: 'textDocument/callHierarchy/incomingCalls' +/// - params: `CallHierarchyIncomingCallsParams` defined follows: +using CallHierarchyIncomingCallsParams = Combine; + +struct CallHierarchyIncomingCall { + /// The item that was called. + CallHierarchyItem from; + /// The range at which at which the calls were made. + Range fromRanges; +}; + +/// Response: +/// - result: `CallHierarchyIncomingCall[]` +using CallHierarchyIncomingCallsResult = std::vector; + +} // namespace clice::protocol diff --git a/include/Protocol/Language.h b/include/Protocol/Language/CodeAction.h similarity index 100% rename from include/Protocol/Language.h rename to include/Protocol/Language/CodeAction.h diff --git a/include/Protocol/Language/CodeLens.h b/include/Protocol/Language/CodeLens.h new file mode 100644 index 00000000..89f028f3 --- /dev/null +++ b/include/Protocol/Language/CodeLens.h @@ -0,0 +1,36 @@ +#include "../Basic.h" + +namespace clice::protocol { + +/// Client Capability: +/// - property name (optional): `textDocument/codeLens` +/// - property type: `CodeLensClientCapabilities` defined as follows: +struct CodeLensClientCapabilities { + /// Whether codeLens supports dynamic registration. + bool dynamicRegistration = false; +}; + +struct CodeLensParamsBody { + /// The document to request code lens for. + TextDocumentIdentifier textDocument; +}; + +/// Request: +/// - method: 'textDocument/codeLens' +/// - params: `CodeLensParams` defined follows: +using CodeLensParams = Combine< + // WorkDoneProgressParams, + // PartialResultParams, + CodeLensParamsBody>; + +struct CodeLens { + /// The range in which this code lens is valid. Should only span a single line. + Range range; + + /// The command this code lens represents. + /// TODO: Command command; + + /// data?: LSPAny; +}; + +} // namespace clice::protocol diff --git a/include/Protocol/Lifecycle.h b/include/Protocol/Language/Completion.h similarity index 100% rename from include/Protocol/Lifecycle.h rename to include/Protocol/Language/Completion.h diff --git a/include/Protocol/Language/Declaration.h b/include/Protocol/Language/Declaration.h new file mode 100644 index 00000000..2146c6a4 --- /dev/null +++ b/include/Protocol/Language/Declaration.h @@ -0,0 +1,30 @@ +#include "../Basic.h" + +namespace clice::protocol { + +/// Client Capability: +/// - property name (optional): `textDocument.declaration` +/// - property type: `DeclarationClientCapabilities` defined as follows: +struct DeclarationClientCapabilities { + /// Whether declaration supports dynamic registration. If this is set to + ///`true` the client supports the new `DeclarationRegistrationOptions` + /// return value for the corresponding server capability as well. + bool dynamicRegistration = false; + + /// The client supports additional metadata in the form of declaration links. + bool linkSupport = false; +}; + +/// Request: +/// - method: 'textDocument/declaration' +/// - params: `DeclarationParams` defined follows: +using DeclarationParams = Combine; + +/// Response: +/// result: Location +using DeclarationResult = Location; + +} // namespace clice::protocol diff --git a/include/Protocol/Language/Definition.h b/include/Protocol/Language/Definition.h new file mode 100644 index 00000000..a5195292 --- /dev/null +++ b/include/Protocol/Language/Definition.h @@ -0,0 +1,29 @@ +#include "../Basic.h" + +namespace clice::protocol { + +/// Client Capability: +/// - property name (optional): `textDocument.definition` +/// - property type: `DefinitionClientCapabilities` defined as follows: +struct DefinitionClientCapabilities { + + /// Whether definition supports dynamic registration. + bool dynamicRegistration = false; + + /// The client supports additional metadata in the form of definition links. + bool linkSupport = false; +}; + +/// Request: +/// - method: 'textDocument/definition' +/// - params: `DefinitionParams` defined follows: +using DefinitionParams = Combine; + +/// Response: +/// result: Location +using DefinitionResult = Location; + +} // namespace clice::protocol diff --git a/include/Protocol/Language/DocumentColor.h b/include/Protocol/Language/DocumentColor.h new file mode 100644 index 00000000..e69de29b diff --git a/include/Protocol/Language/DocumentHighlight.h b/include/Protocol/Language/DocumentHighlight.h new file mode 100644 index 00000000..d2d61a9b --- /dev/null +++ b/include/Protocol/Language/DocumentHighlight.h @@ -0,0 +1,46 @@ +#include "../Basic.h" + +namespace clice::protocol { + +/// Client Capability: +/// - property name (optional): `textDocument.documentHighlight` +/// - property type: `DocumentHighlightClientCapabilities` defined as follows: +struct DocumentHighlightClientCapabilities { + + /// Whether documentHighlight supports dynamic registration. + bool dynamicRegistration = false; +}; + +/// Request: +/// - method: 'textDocument/documentHighlight' +/// - params: `DocumentHighlightParams` defined follows: +using DocumentHighlightParams = Combine; +/// A document highlight kind. +enum class DocumentHighlightKind { + /// A textual occurrence. + Text = 1, + /// Read-access of a symbol, like reading a variable. + Read = 2, + /// Write-access of a symbol, like writing to a variable. + Write = 3, +}; + +/// A document highlight is a range inside a text document which deserves +/// special attention. Usually a document highlight is visualized by changing +/// the background color of its range. +struct DocumentHighlight { + /// The range this highlight applies to. + Range range; + + /// The highlight kind, default is DocumentHighlightKind.Text. + DocumentHighlightKind kind = DocumentHighlightKind::Text; +}; + +/// Response: +/// result: DocumentHighlight[] +using DocumentHighlightResult = std::vector; + +} // namespace clice::protocol diff --git a/include/Protocol/Language/DocumentLink.h b/include/Protocol/Language/DocumentLink.h new file mode 100644 index 00000000..5fba88b8 --- /dev/null +++ b/include/Protocol/Language/DocumentLink.h @@ -0,0 +1,50 @@ +#include "../Basic.h" + +namespace clice::protocol { + +/// Client Capability: +/// - property name (optional): `textDocument.documentLink` +/// - property type: `DocumentLinkClientCapabilities` defined as follows: +struct DocumentLinkClientCapabilities { + + /// Whether documentLink supports dynamic registration. + bool dynamicRegistration = false; + + /// Whether the client support the `tooltip` property on `DocumentLink`. + bool tooltipSupport = false; +}; + +struct DocumentLinkParamsBody { + /// The document to provide document links for. + TextDocumentIdentifier textDocument; +}; + +/// Request: +/// - method: 'textDocument/documentLink' +/// - params: `DocumentLinkParams` defined follows: +using DocumentLinkParams = Combine< + // WorkDoneProgressParams, + // PartialResultParams, + DocumentLinkParamsBody>; + +/// A document link is a range in a text document that links to an internal or +/// external resource, like another text document or a web site. +struct DocumentLink { + /// The range this link applies to. + Range range; + + /// The uri this link points to. If missing a resolve request is sent later. + std::string target; + + /// The tooltip text when you hover over this link. + std::string tooltip; + + // data?: LSPAny; +}; + +/// Response: +/// - result: `DocumentLink[]` +using DocumentLinkResult = std::vector; + +} // namespace clice::protocol + diff --git a/include/Protocol/Language/DocumentSymbol.h b/include/Protocol/Language/DocumentSymbol.h new file mode 100644 index 00000000..3d05fdd0 --- /dev/null +++ b/include/Protocol/Language/DocumentSymbol.h @@ -0,0 +1,70 @@ +#include "../Basic.h" + +namespace clice::protocol { + +/// A symbol kind. +enum class SymbolKind : uint8_t { + File = 1, + Module, + Namespace, + Package, + Class, + Method, + Property, + Field, + Constructor, + Enum, + Interface, + Function, + Variable, + Constant, + String, + Number, + Boolean, + Array, + Object, + Key, + Null, + EnumMember, + Struct, + Event, + Operator, + TypeParameter +}; + +/// Symbol tags are extra annotations that tweak the rendering of a symbol. +enum class SymbolTag : uint8_t { + /// Render a symbol as obsolete, usually using a strike-out. + Deprecated = 1, +}; + +/// Represents programming constructs like variables, classes, interfaces etc. +/// that appear in a document. Document symbols can be hierarchical and they +/// have two ranges: one that encloses its definition and one that points to its +/// most interesting range, e.g. the range of an identifier. +struct DocumentSymbol { + /// The name of this symbol. + String name; + + /// More detail for this symbol, e.g the signature of a function. + String detail; + + /// The kind of this symbol. + SymbolKind kind; + + /// Tags for this symbol. + std::vector tags; + + /// The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. + /// comments and code. + Range range; + + /// The range that should be selected and revealed when this symbol is being picked, e.g. the name of a + /// function. Must be contained by the `range`. + Range selectionRange; + + /// Children of this symbol, e.g. properties of a class. + std::vector children; +}; + +} // namespace clice::protocol diff --git a/include/Protocol/Language/FoldingRange.h b/include/Protocol/Language/FoldingRange.h new file mode 100644 index 00000000..e69de29b diff --git a/include/Protocol/Language/Formatting.h b/include/Protocol/Language/Formatting.h new file mode 100644 index 00000000..e69de29b diff --git a/include/Protocol/Language/Hover.h b/include/Protocol/Language/Hover.h new file mode 100644 index 00000000..504be111 --- /dev/null +++ b/include/Protocol/Language/Hover.h @@ -0,0 +1,39 @@ +#include "../Basic.h" + +namespace clice::protocol { + +/// Client Capability: +/// - property name (optional): `textDocument/hover` +/// - property type: `HoverClientCapabilities` defined as follows: +struct HoverClientCapabilities { + + /// Whether hover supports dynamic registration. + bool dynamicRegistration = false; + + /// Client supports the follow content formats for the content property. The order describes the preferred + /// format of the client. + std::vector contentFormat; +}; + +/// Request: +/// - method: 'textDocument/hover' +/// - params: `HoverParams` defined follows: +using HoverParams = Combine; + +/// The result of a hover request. +struct Hover { + /// The hover's content + MarkupContent contents; + + /// An optional range is a range inside a text document that is used to visualize a hover, e.g. by + /// changing the background color. + Range range; +}; + +/// Response: +/// result: Hover +using HoverResult = Hover; + +} // namespace clice::protocol diff --git a/include/Protocol/Language/Implementation.h b/include/Protocol/Language/Implementation.h new file mode 100644 index 00000000..a0018166 --- /dev/null +++ b/include/Protocol/Language/Implementation.h @@ -0,0 +1,29 @@ +#include "../Basic.h" + +namespace clice::protocol { + +/// Client Capability: +/// - property name (optional): `textDocument.implementation` +/// - property type: `ImplementationClientCapabilities` defined as follows: +struct ImplementationClientCapabilities { + + /// Whether implementation supports dynamic registration. + bool dynamicRegistration = false; + + /// The client supports additional metadata in the form of implementation links. + bool linkSupport = false; +}; + +/// Request: +/// - method: 'textDocument/implementation' +/// - params: `ImplementationParams` defined follows: +using ImplementationParams = Combine; + +/// Response: +/// result: Location +using ImplementationResult = Location; + +} // namespace clice::protocol diff --git a/include/Protocol/Language/InlayHint.h b/include/Protocol/Language/InlayHint.h new file mode 100644 index 00000000..e69de29b diff --git a/include/Protocol/Language/InlineValue.h b/include/Protocol/Language/InlineValue.h new file mode 100644 index 00000000..e69de29b diff --git a/include/Protocol/Language/OnTypeFormatting.h b/include/Protocol/Language/OnTypeFormatting.h new file mode 100644 index 00000000..e69de29b diff --git a/include/Protocol/Language/RangeFormatting.h b/include/Protocol/Language/RangeFormatting.h new file mode 100644 index 00000000..e69de29b diff --git a/include/Protocol/Language/Reference.h b/include/Protocol/Language/Reference.h new file mode 100644 index 00000000..0309f39b --- /dev/null +++ b/include/Protocol/Language/Reference.h @@ -0,0 +1,35 @@ +#include "../Basic.h" + +namespace clice::protocol { + +/// Client Capability: +/// - property name (optional): `textDocument.references` +/// - property type: `ReferenceClientCapabilities` defined as follows: +struct ReferenceClientCapabilities { + + /// Whether references supports dynamic registration. + bool dynamicRegistration = false; +}; + +struct ReferenceContext { + /// Include the declaration of the current symbol. + bool includeDeclaration = false; +}; + +struct ReferenceParamsBody { + ReferenceContext context; +}; + +/// Request: +/// - method: 'textDocument/references' +/// - params: `ReferenceParams` defined follows: +using ReferenceParams = Combine; + +/// Response: +/// result: Location[] +using ReferenceResult = std::vector; + +} // namespace clice::protocol diff --git a/include/Protocol/Language/Rename.h b/include/Protocol/Language/Rename.h new file mode 100644 index 00000000..e69de29b diff --git a/include/Protocol/Language/SelectionRange.h b/include/Protocol/Language/SelectionRange.h new file mode 100644 index 00000000..e69de29b diff --git a/include/Protocol/Language/SemanticToken.h b/include/Protocol/Language/SemanticToken.h new file mode 100644 index 00000000..e69de29b diff --git a/include/Protocol/Language/SignatureHelp.h b/include/Protocol/Language/SignatureHelp.h new file mode 100644 index 00000000..e69de29b diff --git a/include/Protocol/Language/TypeDefinition.h b/include/Protocol/Language/TypeDefinition.h new file mode 100644 index 00000000..5b91c1ec --- /dev/null +++ b/include/Protocol/Language/TypeDefinition.h @@ -0,0 +1,29 @@ +#include "../Basic.h" + +namespace clice::protocol { + +/// Client Capability: +/// - property name (optional): `textDocument/typeDefinition` +/// - property type: `TypeDefinitionClientCapabilities` defined as follows: +struct TypeDefinitionClientCapabilities { + + /// Whether typeDefinition supports dynamic registration. + bool dynamicRegistration = false; + + /// The client supports additional metadata in the form of typeDefinition links. + bool linkSupport = false; +}; + +/// Request: +/// - method: 'textDocument/typeDefinition' +/// - params: `TypeDefinitionParams` defined follows: +using TypeDefinitionParams = Combine; + +/// Response: +/// result: Location +using TypeDefinitionResult = Location; + +} // namespace clice::protocol diff --git a/include/Protocol/Language/TypeHierarchy.h b/include/Protocol/Language/TypeHierarchy.h new file mode 100644 index 00000000..c022d235 --- /dev/null +++ b/include/Protocol/Language/TypeHierarchy.h @@ -0,0 +1,61 @@ +#include "DocumentSymbol.h" + +namespace clice::protocol { + +struct TypeHierarchyItem { + + /// The name of this item. + String name; + + /// The kind of this item. + SymbolKind kind; + + /// Tags for this item. + std::vector tags; + + /// More detail for this item, e.g. the signature of a function. + std::string detail; + + /// The resource identifier of this item. + DocumentUri uri; + + /// The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. + /// comments and code. + Range range; + + /// The range that should be selected and revealed when this symbol is being picked, e.g. the name of a + /// function. + Range selectionRange; + + /// A data entry field that is preserved between a call hierarchy prepare and incoming calls or outgoing + /// calls requests. + /// data?: LSPAny; +}; + +/// Client Capability: +/// - property name (optional): `textDocument/typeHierarchy` +/// - property type: `TypeHierarchyClientCapabilities` defined as follows: +struct TypeHierarchyClientCapabilities { + /// Whether typeHierarchy supports dynamic registration. + bool dynamicRegistration = false; +}; + +/// Request: +/// - method: 'textDocument/prepareTypeHierarchy' +/// - params: `TypeHierarchyParams` defined follows: +using TypeHierarchyParams = Combine; + +/// Response: +/// - result: `TypeHierarchyItem[]` +using TypeHierarchyResult = std::vector; + +/*=========================================================================/ +/ / +/======================== Type Hierarchy Supertypes =======================/ +/ / +/=========================================================================*/ + +// TODO: +} // namespace clice::protocol diff --git a/include/LSP/Protocol.h b/include/Protocol/Protocol.h similarity index 100% rename from include/LSP/Protocol.h rename to include/Protocol/Protocol.h diff --git a/include/LSP/SemanticTokens.h b/include/Protocol/SemanticTokens.h similarity index 100% rename from include/LSP/SemanticTokens.h rename to include/Protocol/SemanticTokens.h diff --git a/main.cpp b/main.cpp index 23a649c2..fd40910d 100644 --- a/main.cpp +++ b/main.cpp @@ -1,13 +1,4 @@ -template -struct X { - static void fooooooooooooooo(int x); - void bar() { - X x; - // X::bar - } - static void bar2(); -}; diff --git a/src/LSP/Server.cpp b/src/LSP/Server.cpp index 1d99fb12..e7e6b0ff 100644 --- a/src/LSP/Server.cpp +++ b/src/LSP/Server.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include @@ -18,7 +18,7 @@ int Server::run(int argc, char** argv) { setting = deserialize(json::parse(argv[1])); logger::info("settings: {}", argv[1]); - loop = uv_default_loop(); + uv_loop_t* loop = uv_default_loop(); if(setting.mode == "pipe") { transport = std::make_unique(); @@ -38,7 +38,7 @@ int Server::run(int argc, char** argv) { int Server::exit() { // stop the event loop - uv_stop(loop); + uv_stop(uv_default_loop()); return 0; } @@ -70,7 +70,7 @@ void Server::handle_message(std::string_view message) { Task Server::didOpen(const DidOpenTextDocumentParams& params) { logger::info("textDocument/didOpen: {}", params.textDocument.uri); auto& textDocument = params.textDocument; - co_await scheduler.update(textDocument.uri, textDocument.text); + co_await scheduler->update(textDocument.uri, textDocument.text); } } // namespace clice