diff --git a/src/providers/dart_symbol_provider.ts b/src/providers/dart_symbol_provider.ts index 329856dc35..e7b67ad337 100644 --- a/src/providers/dart_symbol_provider.ts +++ b/src/providers/dart_symbol_provider.ts @@ -1,5 +1,5 @@ import * as path from "path"; -import { CancellationToken, DocumentSymbolProvider, SymbolInformation, TextDocument, Uri, WorkspaceSymbolProvider, workspace } from "vscode"; +import { CancellationToken, DocumentSymbolProvider, Location, SymbolInformation, TextDocument, Uri, workspace, WorkspaceSymbolProvider } from "vscode"; import * as as from "../analysis/analysis_server_types"; import { Analyzer, getSymbolKindForElementKind } from "../analysis/analyzer"; import { fsPath, toRangeOnLine } from "../utils"; @@ -55,15 +55,15 @@ export class DartSymbolProvider implements WorkspaceSymbolProvider, DocumentSymb containerName = result.className || ""; } - return { - containerName, - kind: getSymbolKindForElementKind(result.kind), - location: { - range: toRangeOnLine({ startLine: result.line, startColumn: result.column, length: 0 }), - uri: Uri.file(file), - }, + return new SymbolInformation( name, - }; + getSymbolKindForElementKind(result.kind), + containerName, + new Location( + Uri.file(file), + toRangeOnLine({ startLine: result.line, startColumn: result.column, length: 0 }), + ), + ); } private createDisplayPath(inputPath: string): string { diff --git a/src/providers/legacy_dart_document_symbol_provider.ts b/src/providers/legacy_dart_document_symbol_provider.ts index 77ba3e928f..c0ca407637 100644 --- a/src/providers/legacy_dart_document_symbol_provider.ts +++ b/src/providers/legacy_dart_document_symbol_provider.ts @@ -1,4 +1,4 @@ -import { CancellationToken, DocumentSymbolProvider, Range, SymbolInformation, TextDocument, Uri } from "vscode"; +import { CancellationToken, DocumentSymbolProvider, Location, Range, SymbolInformation, TextDocument, Uri } from "vscode"; import * as as from "../analysis/analysis_server_types"; import { Analyzer, getSymbolKindForElementKind } from "../analysis/analyzer"; import { fsPath } from "../utils"; @@ -42,15 +42,15 @@ export class LegacyDartDocumentSymbolProvider implements DocumentSymbolProvider if (element.parameters && element.kind !== "SETTER") name = `${name}${element.parameters}`; - symbols.push({ - containerName: parent && parent.name, - kind: getSymbolKindForElementKind(element.kind), - location: { - range: this.getRange(document, outline), - uri: Uri.file(element.location.file), - }, + symbols.push(new SymbolInformation( name, - }); + getSymbolKindForElementKind(element.kind), + parent && parent.name, + new Location( + Uri.file(element.location.file), + this.getRange(document, outline), + ), + )); if (outline.children) { for (const child of outline.children)