codemirror-languageserver 1.15.0 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ import { Extension } from '@codemirror/state';
2
+ export declare const autocompletion: () => Extension;
@@ -1,4 +1,8 @@
1
1
  import { Command, KeyBinding } from '@codemirror/view';
2
2
  export declare const jumpToDefinition: Command;
3
3
  export declare const jumpToDefinitionPos: (pos: number) => Command;
4
+ export declare const jumpToDeclaration: Command;
5
+ export declare const jumpToDeclarationPos: (pos: number) => Command;
6
+ export declare const jumpToTypeDefinition: Command;
7
+ export declare const jumpToTypeDefinitionPos: (pos: number) => Command;
4
8
  export declare const jumpToDefinitionKeymap: readonly KeyBinding[];
@@ -0,0 +1,2 @@
1
+ import { Extension } from '@codemirror/state';
2
+ export declare const hoverTooltip: () => Extension;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,15 @@
1
- export { LanguageServerClient, languageServerPlugin, languageServer, languageServerWithTransport, } from './plugin';
1
+ export { LanguageServerClient, languageServerPlugin } from './plugin';
2
2
  export { jumpToDefinition, jumpToDefinitionPos, jumpToDefinitionKeymap, } from './definition';
3
+ export { PyrightInitializationOptions, RustAnalyzerInitializationOptions, TypeScriptInitializationOptions, ESLintInitializationOptions, ClangdInitializationOptions, GoplsInitializationOptions, } from './initialization';
4
+ import { LanguageServerClient } from './plugin';
5
+ import type { LanguageServerClientOptions, LanguageServerBaseOptions } from './plugin';
6
+ interface LanguageServerOptions<InitializationOptions = unknown> extends LanguageServerClientOptions<InitializationOptions> {
7
+ client?: LanguageServerClient<InitializationOptions>;
8
+ allowHTMLContent?: boolean;
9
+ }
10
+ interface LanguageServerWebsocketOptions<InitializationOptions = unknown> extends LanguageServerBaseOptions {
11
+ serverUri: `ws://${string}` | `wss://${string}`;
12
+ initializationOptions?: InitializationOptions;
13
+ }
14
+ export declare function languageServer<InitializationOptions = unknown>(options: LanguageServerWebsocketOptions<InitializationOptions>): import("@codemirror/state").Extension[];
15
+ export declare function languageServerWithTransport<InitializationOptions = unknown>(options: LanguageServerOptions<InitializationOptions>): import("@codemirror/state").Extension[];
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { insertCompletionText, autocompletion } from '@codemirror/autocomplete';
1
+ import { insertCompletionText, autocompletion as autocompletion$1 } from '@codemirror/autocomplete';
2
2
  import { setDiagnostics } from '@codemirror/lint';
3
3
  import { Facet } from '@codemirror/state';
4
- import { ViewPlugin, hoverTooltip } from '@codemirror/view';
4
+ import { ViewPlugin, hoverTooltip as hoverTooltip$1, EditorView, keymap } from '@codemirror/view';
5
5
  import { RequestManager, Client, WebSocketTransport } from '@open-rpc/client-js';
6
6
  import { CompletionItemKind, DiagnosticSeverity, CompletionTriggerKind } from 'vscode-languageserver-protocol';
7
7
  import { marked } from 'marked';
@@ -28,11 +28,11 @@ const timeout = 10000;
28
28
  const changesDelay = 500;
29
29
  const CompletionItemKindMap = Object.fromEntries(Object.entries(CompletionItemKind).map(([key, value]) => [value, key]));
30
30
  const useLast = (values) => values.reduce((_, v) => v, '');
31
- const client = Facet.define({
31
+ Facet.define({
32
32
  combine: useLast,
33
33
  });
34
- const documentUri = Facet.define({ combine: useLast });
35
- const languageId = Facet.define({ combine: useLast });
34
+ Facet.define({ combine: useLast });
35
+ Facet.define({ combine: useLast });
36
36
  class LanguageServerClient {
37
37
  constructor(options) {
38
38
  this.options = options;
@@ -70,7 +70,7 @@ class LanguageServerClient {
70
70
  textDocument: {
71
71
  hover: {
72
72
  dynamicRegistration: true,
73
- contentFormat: ['plaintext', 'markdown'],
73
+ contentFormat: ['markdown', 'plaintext'],
74
74
  },
75
75
  moniker: {},
76
76
  synchronization: {
@@ -84,16 +84,19 @@ class LanguageServerClient {
84
84
  completionItem: {
85
85
  snippetSupport: false,
86
86
  commitCharactersSupport: true,
87
- documentationFormat: ['plaintext', 'markdown'],
87
+ documentationFormat: ['markdown', 'plaintext'],
88
88
  deprecatedSupport: false,
89
89
  preselectSupport: false,
90
+ resolveSupport: {
91
+ properties: ['detail', 'documentation'],
92
+ },
90
93
  },
91
94
  contextSupport: true,
92
95
  },
93
96
  signatureHelp: {
94
97
  dynamicRegistration: true,
95
98
  signatureInformation: {
96
- documentationFormat: ['plaintext', 'markdown'],
99
+ documentationFormat: ['markdown', 'plaintext'],
97
100
  },
98
101
  },
99
102
  declaration: {
@@ -149,6 +152,15 @@ class LanguageServerClient {
149
152
  async textDocumentDefinition(params) {
150
153
  return await this.request('textDocument/definition', params, timeout);
151
154
  }
155
+ async textDocumentDeclaration(params) {
156
+ return await this.request('textDocument/declaration', params, timeout);
157
+ }
158
+ async textDocumentTypeDefinition(params) {
159
+ return await this.request('textDocument/typeDefinition', params, timeout);
160
+ }
161
+ async completionItemResolve(params) {
162
+ return await this.request('completionItem/resolve', params, timeout);
163
+ }
152
164
  attachPlugin(plugin) {
153
165
  this.plugins.push(plugin);
154
166
  }
@@ -175,12 +187,12 @@ class LanguageServerClient {
175
187
  }
176
188
  }
177
189
  class LanguageServerPlugin {
178
- constructor(view, allowHTMLContent) {
190
+ constructor(view, { client, documentUri, languageId, allowHTMLContent, }) {
179
191
  this.view = view;
192
+ this.client = client;
193
+ this.documentUri = documentUri;
194
+ this.languageId = languageId;
180
195
  this.allowHTMLContent = allowHTMLContent;
181
- this.client = this.view.state.facet(client);
182
- this.documentUri = this.view.state.facet(documentUri);
183
- this.languageId = this.view.state.facet(languageId);
184
196
  this.documentVersion = 0;
185
197
  this.changesTimeout = 0;
186
198
  this.client.attachPlugin(this);
@@ -322,7 +334,8 @@ class LanguageServerPlugin {
322
334
  });
323
335
  }
324
336
  }
325
- const options = items.map(({ detail, label, kind, textEdit, documentation, additionalTextEdits, }) => {
337
+ const options = items.map((item) => {
338
+ const { detail, label, kind, textEdit, documentation, additionalTextEdits, } = item;
326
339
  const completion = {
327
340
  label,
328
341
  detail,
@@ -360,20 +373,26 @@ class LanguageServerPlugin {
360
373
  },
361
374
  type: kind && CompletionItemKindMap[kind].toLowerCase(),
362
375
  };
363
- if (documentation) {
364
- completion.info = async () => {
365
- const dom = document.createElement('div');
366
- dom.classList.add('documentation');
367
- if (this.allowHTMLContent) {
368
- dom.innerHTML = await formatContents(documentation);
369
- }
370
- else {
371
- dom.textContent =
372
- await formatContents(documentation);
373
- }
374
- return dom;
375
- };
376
- }
376
+ completion.info = async () => {
377
+ var _a;
378
+ let { documentation } = item;
379
+ if (!documentation &&
380
+ ((_a = this.client.capabilities.completionProvider) === null || _a === void 0 ? void 0 : _a.resolveProvider)) {
381
+ const resolvedItem = await this.client.completionItemResolve(item);
382
+ documentation = resolvedItem.documentation;
383
+ }
384
+ if (!documentation)
385
+ return null;
386
+ const dom = document.createElement('div');
387
+ dom.classList.add('documentation');
388
+ if (this.allowHTMLContent) {
389
+ dom.innerHTML = await formatContents(documentation);
390
+ }
391
+ else {
392
+ dom.textContent = await formatContents(documentation);
393
+ }
394
+ return dom;
395
+ };
377
396
  return completion;
378
397
  });
379
398
  return {
@@ -382,12 +401,11 @@ class LanguageServerPlugin {
382
401
  filter: false,
383
402
  };
384
403
  }
385
- async requestDefinition(view, { line, character }) {
386
- if (!this.client.ready ||
387
- !this.client.capabilities.definitionProvider) {
404
+ async requestLocation(view, { line, character }, capability, method) {
405
+ if (!this.client.ready || !this.client.capabilities[capability]) {
388
406
  return null;
389
407
  }
390
- const result = await this.client.textDocumentDefinition({
408
+ const result = await this.client[method]({
391
409
  textDocument: { uri: this.documentUri },
392
410
  position: { line, character },
393
411
  });
@@ -404,6 +422,7 @@ class LanguageServerPlugin {
404
422
  anchor: posToOffset(view.state.doc, range.start),
405
423
  head: posToOffset(view.state.doc, range.end),
406
424
  },
425
+ scrollIntoView: true,
407
426
  }));
408
427
  }
409
428
  return {
@@ -411,6 +430,15 @@ class LanguageServerPlugin {
411
430
  range,
412
431
  };
413
432
  }
433
+ async requestDefinition(view, { line, character }) {
434
+ return this.requestLocation(view, { line, character }, 'definitionProvider', 'textDocumentDefinition');
435
+ }
436
+ async requestDeclaration(view, { line, character }) {
437
+ return this.requestLocation(view, { line, character }, 'declarationProvider', 'textDocumentDeclaration');
438
+ }
439
+ async requestTypeDefinition(view, { line, character }) {
440
+ return this.requestLocation(view, { line, character }, 'typeDefinitionProvider', 'textDocumentTypeDefinition');
441
+ }
414
442
  processNotification(notification) {
415
443
  try {
416
444
  switch (notification.method) {
@@ -455,58 +483,6 @@ class LanguageServerPlugin {
455
483
  }
456
484
  }
457
485
  const languageServerPlugin = ViewPlugin.fromClass(LanguageServerPlugin);
458
- function languageServer(options) {
459
- const serverUri = options.serverUri;
460
- const { serverUri: _, ...optionsWithoutServerUri } = options;
461
- return languageServerWithTransport({
462
- ...optionsWithoutServerUri,
463
- transport: new WebSocketTransport(serverUri),
464
- });
465
- }
466
- function languageServerWithTransport(options) {
467
- return [
468
- client.of(options.client ||
469
- new LanguageServerClient({
470
- ...options,
471
- autoClose: true,
472
- })),
473
- documentUri.of(options.documentUri),
474
- languageId.of(options.languageId),
475
- languageServerPlugin.of(options.allowHTMLContent),
476
- hoverTooltip((view, pos) => {
477
- var _a;
478
- const plugin = view.plugin(languageServerPlugin);
479
- return ((_a = plugin === null || plugin === void 0 ? void 0 : plugin.requestHoverTooltip(view, offsetToPos(view.state.doc, pos))) !== null && _a !== void 0 ? _a : null);
480
- }),
481
- autocompletion({
482
- override: [
483
- async (context) => {
484
- var _a, _b, _c;
485
- const { state, pos, explicit, view } = context;
486
- const plugin = view.plugin(languageServerPlugin);
487
- if (plugin == null)
488
- return null;
489
- const line = state.doc.lineAt(pos);
490
- let trigKind = CompletionTriggerKind.Invoked;
491
- let trigChar;
492
- if (!explicit &&
493
- ((_c = (_b = (_a = plugin.client.capabilities) === null || _a === void 0 ? void 0 : _a.completionProvider) === null || _b === void 0 ? void 0 : _b.triggerCharacters) === null || _c === void 0 ? void 0 : _c.includes(line.text[pos - line.from - 1]))) {
494
- trigKind = CompletionTriggerKind.TriggerCharacter;
495
- trigChar = line.text[pos - line.from - 1];
496
- }
497
- if (trigKind === CompletionTriggerKind.Invoked &&
498
- !context.matchBefore(/\w+$/)) {
499
- return null;
500
- }
501
- return await plugin.requestCompletion(context, offsetToPos(state.doc, pos), {
502
- triggerCharacter: trigChar,
503
- triggerKind: trigKind,
504
- });
505
- },
506
- ],
507
- }),
508
- ];
509
- }
510
486
  async function formatContents(contents) {
511
487
  if (isLSPMarkupContent(contents)) {
512
488
  let value = contents.value;
@@ -554,17 +530,104 @@ function isLSPMarkupContent(contents) {
554
530
  return contents.kind !== undefined;
555
531
  }
556
532
 
557
- function jumpTo(view, pos) {
533
+ function requestDefinition(view, pos) {
558
534
  const plugin = view.plugin(languageServerPlugin);
559
535
  if (!plugin)
560
536
  return false;
561
537
  plugin.requestDefinition(view, offsetToPos(view.state.doc, pos));
562
538
  return true;
563
539
  }
564
- const jumpToDefinition = (view) => jumpTo(view, view.state.selection.main.head);
565
- const jumpToDefinitionPos = (pos) => (view) => jumpTo(view, pos);
540
+ function requestTypeDefinition(view, pos) {
541
+ const plugin = view.plugin(languageServerPlugin);
542
+ if (!plugin)
543
+ return false;
544
+ plugin.requestTypeDefinition(view, offsetToPos(view.state.doc, pos));
545
+ return true;
546
+ }
547
+ const jumpToDefinition = (view) => requestDefinition(view, view.state.selection.main.head);
548
+ const jumpToDefinitionPos = (pos) => (view) => requestDefinition(view, pos);
549
+ const jumpToTypeDefinition = (view) => requestTypeDefinition(view, view.state.selection.main.head);
550
+ const jumpToTypeDefinitionPos = (pos) => (view) => requestTypeDefinition(view, pos);
566
551
  const jumpToDefinitionKeymap = [
567
552
  { key: 'F12', run: jumpToDefinition, preventDefault: true },
553
+ { key: 'Mod-F12', run: jumpToTypeDefinition, preventDefault: true },
568
554
  ];
569
555
 
556
+ const hoverTooltip = () => hoverTooltip$1((view, pos) => {
557
+ var _a;
558
+ const plugin = view.plugin(languageServerPlugin);
559
+ return ((_a = plugin === null || plugin === void 0 ? void 0 : plugin.requestHoverTooltip(view, offsetToPos(view.state.doc, pos))) !== null && _a !== void 0 ? _a : null);
560
+ });
561
+
562
+ const autocompletion = () => autocompletion$1({
563
+ override: [
564
+ async (context) => {
565
+ var _a, _b, _c;
566
+ const { state, pos, explicit, view } = context;
567
+ const plugin = view.plugin(languageServerPlugin);
568
+ if (plugin == null)
569
+ return null;
570
+ const line = state.doc.lineAt(pos);
571
+ let trigKind = CompletionTriggerKind.Invoked;
572
+ let trigChar;
573
+ if (!explicit &&
574
+ ((_c = (_b = (_a = plugin.client.capabilities) === null || _a === void 0 ? void 0 : _a.completionProvider) === null || _b === void 0 ? void 0 : _b.triggerCharacters) === null || _c === void 0 ? void 0 : _c.includes(line.text[pos - line.from - 1]))) {
575
+ trigKind = CompletionTriggerKind.TriggerCharacter;
576
+ trigChar = line.text[pos - line.from - 1];
577
+ }
578
+ if (trigKind === CompletionTriggerKind.Invoked &&
579
+ !context.matchBefore(/\w+$/)) {
580
+ return null;
581
+ }
582
+ return await plugin.requestCompletion(context, offsetToPos(state.doc, pos), {
583
+ triggerCharacter: trigChar,
584
+ triggerKind: trigKind,
585
+ });
586
+ },
587
+ ],
588
+ });
589
+
590
+ const mouseHandler = () => EditorView.domEventHandlers({
591
+ mousedown: (event, view) => {
592
+ if (!event.ctrlKey && !event.metaKey)
593
+ return;
594
+ const pos = view.posAtCoords({
595
+ x: event.clientX,
596
+ y: event.clientY,
597
+ });
598
+ const ok = (event.shiftKey
599
+ ? jumpToTypeDefinitionPos(pos)
600
+ : jumpToDefinitionPos(pos))(view);
601
+ if (ok)
602
+ event.preventDefault();
603
+ },
604
+ });
605
+
606
+ function languageServer(options) {
607
+ const serverUri = options.serverUri;
608
+ const { serverUri: _, ...optionsWithoutServerUri } = options;
609
+ return languageServerWithTransport({
610
+ ...optionsWithoutServerUri,
611
+ transport: new WebSocketTransport(serverUri),
612
+ });
613
+ }
614
+ function languageServerWithTransport(options) {
615
+ return [
616
+ languageServerPlugin.of({
617
+ client: options.client ||
618
+ new LanguageServerClient({
619
+ ...options,
620
+ autoClose: true,
621
+ }),
622
+ documentUri: options.documentUri,
623
+ languageId: options.languageId,
624
+ allowHTMLContent: options.allowHTMLContent,
625
+ }),
626
+ hoverTooltip(),
627
+ autocompletion(),
628
+ keymap.of([...jumpToDefinitionKeymap]),
629
+ mouseHandler(),
630
+ ];
631
+ }
632
+
570
633
  export { LanguageServerClient, jumpToDefinition, jumpToDefinitionKeymap, jumpToDefinitionPos, languageServer, languageServerPlugin, languageServerWithTransport };
@@ -0,0 +1,279 @@
1
+ /**
2
+ * Initialization options for Pyright language server
3
+ * @see https://github.com/microsoft/pyright/blob/main/docs/settings.md
4
+ */
5
+ export interface PyrightInitializationOptions {
6
+ python?: {
7
+ pythonPath?: string;
8
+ venvPath?: string;
9
+ analysis?: {
10
+ autoSearchPaths?: boolean;
11
+ extraPaths?: string[];
12
+ diagnosticMode?: 'workspace' | 'openFilesOnly';
13
+ stubPath?: string;
14
+ typeshedPaths?: string[];
15
+ useLibraryCodeForTypes?: boolean;
16
+ typeCheckingMode?: 'off' | 'basic' | 'strict';
17
+ autoImportCompletions?: boolean;
18
+ indexing?: boolean;
19
+ };
20
+ };
21
+ reportMissingImports?: boolean;
22
+ reportMissingTypeStubs?: boolean;
23
+ reportMissingModuleSource?: boolean;
24
+ reportInvalidTypeVarUse?: boolean;
25
+ reportOptionalSubscript?: boolean;
26
+ reportOptionalMemberAccess?: boolean;
27
+ reportOptionalCall?: boolean;
28
+ reportOptionalIterable?: boolean;
29
+ reportOptionalContextManager?: boolean;
30
+ reportOptionalOperand?: boolean;
31
+ reportTypedDictNotRequiredAccess?: boolean;
32
+ reportPrivateImportUsage?: boolean;
33
+ reportConstantRedefinition?: boolean;
34
+ reportIncompatibleMethodOverride?: boolean;
35
+ reportIncompatibleVariableOverride?: boolean;
36
+ reportInconsistentConstructor?: boolean;
37
+ }
38
+ /**
39
+ * Initialization options for Rust Analyzer language server
40
+ * @see https://rust-analyzer.github.io/manual.html#configuration
41
+ */
42
+ export interface RustAnalyzerInitializationOptions {
43
+ cargo?: {
44
+ buildScripts?: {
45
+ enable?: boolean;
46
+ invocationStrategy?: 'per_workspace' | 'once';
47
+ invocationLocation?: 'workspace' | 'root';
48
+ };
49
+ allTargets?: boolean;
50
+ noDefaultFeatures?: boolean;
51
+ allFeatures?: boolean;
52
+ features?: string[];
53
+ target?: string;
54
+ runBuildScripts?: boolean;
55
+ useRustcWrapperForBuildScripts?: boolean;
56
+ };
57
+ procMacro?: {
58
+ enable?: boolean;
59
+ ignored?: Record<string, string[]>;
60
+ server?: string;
61
+ attributes?: {
62
+ enable?: boolean;
63
+ };
64
+ };
65
+ diagnostics?: {
66
+ enable?: boolean;
67
+ disabled?: string[];
68
+ warningsAsHint?: string[];
69
+ warningsAsInfo?: string[];
70
+ remapPrefix?: Record<string, string>;
71
+ experimental?: {
72
+ enable?: boolean;
73
+ };
74
+ };
75
+ completion?: {
76
+ addCallArgumentSnippets?: boolean;
77
+ addCallParenthesis?: boolean;
78
+ postfix?: {
79
+ enable?: boolean;
80
+ };
81
+ autoimport?: {
82
+ enable?: boolean;
83
+ };
84
+ privateEditable?: {
85
+ enable?: boolean;
86
+ };
87
+ };
88
+ assist?: {
89
+ importGranularity?: 'preserve' | 'crate' | 'module' | 'item';
90
+ importEnforceGranularity?: boolean;
91
+ importPrefix?: 'plain' | 'by_self' | 'by_crate';
92
+ allowMergingIntoGlobImports?: boolean;
93
+ };
94
+ callInfo?: {
95
+ full?: boolean;
96
+ };
97
+ lens?: {
98
+ enable?: boolean;
99
+ run?: boolean;
100
+ debug?: boolean;
101
+ implementations?: boolean;
102
+ refs?: boolean;
103
+ methodReferences?: boolean;
104
+ references?: boolean;
105
+ enumVariantReferences?: boolean;
106
+ };
107
+ hover?: {
108
+ documentation?: boolean;
109
+ keywords?: boolean;
110
+ linksInHover?: boolean;
111
+ memoryLayout?: {
112
+ enable?: boolean;
113
+ };
114
+ };
115
+ workspace?: {
116
+ symbol?: {
117
+ search?: {
118
+ scope?: 'workspace' | 'workspace_and_dependencies';
119
+ kind?: 'only_types' | 'all_symbols';
120
+ };
121
+ };
122
+ };
123
+ }
124
+ /**
125
+ * Initialization options for TypeScript/JavaScript language server
126
+ * @see https://github.com/typescript-language-server/typescript-language-server
127
+ */
128
+ export interface TypeScriptInitializationOptions {
129
+ hostInfo?: string;
130
+ npmLocation?: string;
131
+ globalPlugins?: string[];
132
+ pluginProbeLocations?: string[];
133
+ preferences?: {
134
+ includePackageJsonAutoImports?: 'auto' | 'on' | 'off';
135
+ providePrefixAndSuffixTextForRename?: boolean;
136
+ allowRenameOfImportPath?: boolean;
137
+ includeAutomaticOptionalChainCompletions?: boolean;
138
+ includeCompletionsForModuleExports?: boolean;
139
+ includeCompletionsForImportStatements?: boolean;
140
+ includeCompletionsWithSnippetText?: boolean;
141
+ includeCompletionsWithInsertText?: boolean;
142
+ allowIncompleteCompletions?: boolean;
143
+ importModuleSpecifier?: 'shortest' | 'relative' | 'absolute' | 'auto';
144
+ importModuleSpecifierEnding?: 'minimal' | 'index' | 'js';
145
+ allowTextChangesInNewFiles?: boolean;
146
+ lazyConfiguredProjectsFromExternalProject?: boolean;
147
+ providePrefixAndSuffixTextForQuickInfo?: boolean;
148
+ includeInlayParameterNameHints?: 'none' | 'literals' | 'all';
149
+ includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean;
150
+ includeInlayFunctionParameterTypeHints?: boolean;
151
+ includeInlayVariableTypeHints?: boolean;
152
+ includeInlayVariableTypeHintsWhenTypeMatchesName?: boolean;
153
+ includeInlayPropertyDeclarationTypeHints?: boolean;
154
+ includeInlayFunctionLikeReturnTypeHints?: boolean;
155
+ includeInlayEnumMemberValueHints?: boolean;
156
+ };
157
+ locale?: string;
158
+ maxTsServerMemory?: number;
159
+ tsserver?: {
160
+ logLevel?: 'off' | 'terse' | 'normal' | 'requestTime' | 'verbose';
161
+ logVerbosity?: 'off' | 'terse' | 'normal' | 'requestTime' | 'verbose';
162
+ trace?: 'off' | 'messages' | 'verbose';
163
+ useSeparateSyntaxServer?: boolean;
164
+ enableTracing?: boolean;
165
+ path?: string;
166
+ };
167
+ }
168
+ /**
169
+ * Initialization options for ESLint language server
170
+ * @see https://github.com/Microsoft/vscode-eslint
171
+ */
172
+ export interface ESLintInitializationOptions {
173
+ packageManager?: 'npm' | 'yarn' | 'pnpm';
174
+ nodePath?: string;
175
+ options?: Record<string, any>;
176
+ rules?: Record<string, any>;
177
+ rulesCustomizations?: Array<{
178
+ rule: string;
179
+ severity: 'downgrade' | 'upgrade' | 'info' | 'warn' | 'error' | 'off';
180
+ }>;
181
+ run?: 'onType' | 'onSave';
182
+ problems?: {
183
+ shortenToSingleLine?: boolean;
184
+ };
185
+ codeAction?: {
186
+ disableRuleComment?: {
187
+ enable?: boolean;
188
+ location?: 'separateLine' | 'sameLine';
189
+ };
190
+ showDocumentation?: {
191
+ enable?: boolean;
192
+ };
193
+ };
194
+ codeActionOnSave?: {
195
+ enable?: boolean;
196
+ mode?: 'all' | 'problems';
197
+ };
198
+ format?: {
199
+ enable?: boolean;
200
+ };
201
+ quiet?: boolean;
202
+ onIgnoredFiles?: 'off' | 'warn';
203
+ useESLintClass?: boolean;
204
+ experimental?: {
205
+ useFlatConfig?: boolean;
206
+ };
207
+ workingDirectory?: {
208
+ mode?: 'auto' | 'location';
209
+ };
210
+ }
211
+ /**
212
+ * Initialization options for Clangd language server
213
+ * @see https://clangd.llvm.org/config
214
+ */
215
+ export interface ClangdInitializationOptions {
216
+ compilationDatabasePath?: string;
217
+ compilationDatabaseChanges?: Record<string, any>;
218
+ fallbackFlags?: string[];
219
+ clangdFileStatus?: boolean;
220
+ utf8?: boolean;
221
+ offsetEncoding?: ('utf-8' | 'utf-16' | 'utf-32')[];
222
+ index?: {
223
+ background?: 'Build' | 'Skip';
224
+ threads?: number;
225
+ };
226
+ completion?: {
227
+ detailedLabel?: boolean;
228
+ allScopes?: boolean;
229
+ };
230
+ hover?: {
231
+ showAKA?: boolean;
232
+ };
233
+ inlayHints?: {
234
+ enabled?: boolean;
235
+ parameterNames?: boolean;
236
+ deducedTypes?: boolean;
237
+ designators?: boolean;
238
+ };
239
+ semanticHighlighting?: boolean;
240
+ diagnostics?: {
241
+ unusedIncludes?: 'None' | 'Strict';
242
+ missingIncludes?: 'None' | 'Strict';
243
+ clangTidy?: boolean;
244
+ suppressAll?: boolean;
245
+ };
246
+ }
247
+ /**
248
+ * Initialization options for Gopls (Go language server)
249
+ * @see https://github.com/golang/tools/blob/master/gopls/doc/settings.md
250
+ */
251
+ export interface GoplsInitializationOptions {
252
+ buildFlags?: string[];
253
+ env?: Record<string, string>;
254
+ directoryFilters?: string[];
255
+ templateExtensions?: string[];
256
+ memoryMode?: 'DegradeClosed' | 'Normal';
257
+ gofumpt?: boolean;
258
+ staticcheck?: boolean;
259
+ analyses?: Record<string, boolean>;
260
+ codelenses?: Record<string, boolean>;
261
+ usePlaceholders?: boolean;
262
+ completionBudget?: string;
263
+ diagnosticsDelay?: string;
264
+ experimentalPostfixCompletions?: boolean;
265
+ experimentalWorkspaceModule?: boolean;
266
+ experimentalTemplateSupport?: boolean;
267
+ semanticTokens?: boolean;
268
+ noSemanticString?: boolean;
269
+ noSemanticNumber?: boolean;
270
+ expandWorkspaceToModule?: boolean;
271
+ experimentalUseInvalidMetadata?: boolean;
272
+ hoverKind?: 'FullDocumentation' | 'NoDocumentation' | 'SingleLine' | 'Structured' | 'SynopsisDocumentation';
273
+ linkTarget?: string;
274
+ linksInHover?: boolean;
275
+ importShortcut?: 'Both' | 'Definition' | 'Link';
276
+ symbolMatcher?: 'CaseInsensitive' | 'CaseSensitive' | 'FastFuzzy' | 'Fuzzy';
277
+ symbolStyle?: 'Dynamic' | 'Full' | 'Package';
278
+ verboseOutput?: boolean;
279
+ }
@@ -0,0 +1,2 @@
1
+ import { Extension } from '@codemirror/state';
2
+ export declare const mouseHandler: () => Extension;