MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / constructor

Method constructor

src/extension/analysis/analyzer.ts:49–94  ·  view source on GitHub ↗
(logger: Logger, sdks: DartSdks, private readonly dartCapabilities: DartCapabilities, wsContext: WorkspaceContext, private readonly analytics: Analytics)

Source from the content-addressed store, hash-verified

47 private readonly statusItem = getLanguageStatusItem("dart.analysisServer", ANALYSIS_FILTERS);
48
49 constructor(logger: Logger, sdks: DartSdks, private readonly dartCapabilities: DartCapabilities, wsContext: WorkspaceContext, private readonly analytics: Analytics) {
50 super(new CategoryLogger(logger, LogCategory.Analyzer));
51
52 this.setupStatusItem();
53
54 this.client = this.createClient(this.logger, sdks, dartCapabilities, wsContext, this.buildMiddleware());
55 this.disposables.push({ dispose: () => this.client.stop() });
56
57
58 // Set up features that register capabilities and may also wrap client middleware.
59 this.disposables.push(this.refactors = new InteractiveRefactors(logger, this.client));
60 this.disposables.push(this.snippetTextEdits = new SnippetTextEditFeature(this.client));
61 this.disposables.push(this.fileTracker = new FileTracker(logger, this.client, wsContext));
62 this.disposables.push(this.updateDiagnosticInformation = new AnalyzerUpdateDiagnosticInformationFeature(logger, this.client));
63
64 // Register all language client features.
65 this.client.registerFeature(new CommonCapabilitiesFeature().feature);
66 this.client.registerFeature(new AddDependencyCodeActionProvider(this.client).feature);
67 this.client.registerFeature(new LegacyRefactors(this.logger, this.client).feature);
68 this.client.registerFeature(this.refactors.feature);
69 this.client.registerFeature(this.snippetTextEdits.feature);
70 this.client.registerFeature(this.updateDiagnosticInformation.feature);
71
72 void this.client.start().then(() => {
73 this.statusItem.text = "Dart Analysis Server";
74 // Reminder: These onNotification calls only hold ONE handler!
75 this.client.onNotification(OpenUriNotification.type, (params) => {
76 const uri = vs.Uri.parse(params.uri);
77 switch (uri.scheme) {
78 case "file":
79 void vs.window.showTextDocument(uri);
80 break;
81 case "http":
82 case "https":
83 void envUtils.openInBrowser(uri.toString());
84 break;
85 default:
86 this.logger.error(`Unable to open URI ${uri} as requested by LSP server. Unknown scheme.`);
87
88 }
89 });
90 this.onReadyCompleter.resolve();
91
92 void this.updateDiagnosticInformation?.updateDiagnosticInformationIfSupported();
93 });
94 }
95
96 public async connectToDtd(dtd: DartToolingDaemon | undefined): Promise<void> {
97 if (!dtd)

Callers

nothing calls this directly

Calls 10

setupStatusItemMethod · 0.95
createClientMethod · 0.95
buildMiddlewareMethod · 0.95
onNotificationMethod · 0.80
openInBrowserMethod · 0.80
errorMethod · 0.65
stopMethod · 0.45
startMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected