21 using OptionMapTy = std::map<std::string, std::unique_ptr<AttrSetClientProc>>;
24 std::unique_ptr<OwnedEvalClient> Eval;
27 std::unique_ptr<AttrSetClientProc> NixpkgsEval;
29 std::mutex OptionsLock;
43 void evalExprWithProgress(AttrSetClient &Client,
const EvalExprParams &Params,
44 std::string_view Description);
50 std::mutex ConfigLock;
55 WorkspaceConfiguration;
63 void updateConfig(Configuration NewConfig);
72 CreateWorkDoneProgress;
77 llvm::unique_function<void(
79 BeginWorkDoneProgress;
81 void beginWorkDoneProgress(
85 BeginWorkDoneProgress(Params);
88 llvm::unique_function<void(
89 const lspserver::ProgressParams<lspserver::WorkDoneProgressReport> &)>
90 ReportWorkDoneProgress;
92 void reportWorkDoneProgress(
93 const lspserver::ProgressParams<lspserver::WorkDoneProgressReport>
95 if (ClientCaps.WorkDoneProgress)
96 ReportWorkDoneProgress(Params);
99 llvm::unique_function<void(
100 lspserver::ProgressParams<lspserver::WorkDoneProgressEnd>)>
103 void endWorkDoneProgress(
104 const lspserver::ProgressParams<lspserver::WorkDoneProgressEnd> &Params) {
105 if (ClientCaps.WorkDoneProgress)
106 EndWorkDoneProgress(Params);
109 mutable std::mutex TUsLock;
110 llvm::StringMap<std::shared_ptr<NixTU>> TUs;
112 std::shared_ptr<const NixTU> getTU(std::string_view
File)
const {
114 std::lock_guard G(TUsLock);
115 if (!TUs.count(
File)) [[unlikely]] {
119 return TUs.lookup(
File);
122 static std::shared_ptr<nixf::Node> getAST(
const NixTU &TU) {
131 std::shared_ptr<const nixf::Node> getAST(std::string_view
File)
const {
132 auto TU = getTU(
File);
133 return TU ? getAST(*TU) : nullptr;
136 boost::asio::thread_pool Pool;
140 std::optional<int64_t> Version);
144 void onInitialize(
const lspserver::InitializeParams &Params,
149 bool ReceivedShutdown =
false;
151 void onShutdown(
const lspserver::NoParams &,
154 void onDocumentDidOpen(
const lspserver::DidOpenTextDocumentParams &Params);
157 onDocumentDidChange(
const lspserver::DidChangeTextDocumentParams &Params);
159 void onDocumentDidClose(
const lspserver::DidCloseTextDocumentParams &Params);
162 onCodeAction(
const lspserver::CodeActionParams &Params,
165 void onHover(
const lspserver::TextDocumentPositionParams &Params,
168 void onDocumentSymbol(
169 const lspserver::DocumentSymbolParams &Params,
172 void onSemanticTokens(
const lspserver::SemanticTokensParams &Params,
176 onInlayHint(
const lspserver::InlayHintsParams &Params,
179 void onCompletion(
const lspserver::CompletionParams &Params,
183 onCompletionItemResolve(
const lspserver::CompletionItem &Params,
186 void onDefinition(
const lspserver::TextDocumentPositionParams &Params,
190 onReferences(
const lspserver::TextDocumentPositionParams &Params,
193 void onDocumentHighlight(
194 const lspserver::TextDocumentPositionParams &Params,
198 const lspserver::DocumentLinkParams &Params,
201 std::set<nixf::Diagnostic::DiagnosticKind>
202 SuppressedDiagnostics;
204 std::mutex SuppressedDiagnosticsLock;
208 void updateSuppressed(
const std::vector<std::string> &Sup);
211 bool isSuppressed(nixf::Diagnostic::DiagnosticKind Kind);
213 std::optional<int64_t> Version, std::string_view Src,
214 const std::vector<nixf::Diagnostic> &Diagnostics);
216 void onRename(
const lspserver::RenameParams &Params,
220 onPrepareRename(
const lspserver::TextDocumentPositionParams &Params,
223 void onFormat(
const lspserver::DocumentFormattingParams &Params,
229 void onDidChangeConfiguration(
230 const lspserver::DidChangeConfigurationParams &Params);
233 Controller(std::unique_ptr<lspserver::InboundPort> In,
234 std::unique_ptr<lspserver::OutboundPort> Out);