Skip to content

Commit

Permalink
Fix symbol providers to return real instances
Browse files Browse the repository at this point in the history
  • Loading branch information
DanTup committed May 21, 2018
1 parent 20203f6 commit ec2c7c2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions src/providers/dart_symbol_provider.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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 {
Expand Down
18 changes: 9 additions & 9 deletions src/providers/legacy_dart_document_symbol_provider.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit ec2c7c2

Please sign in to comment.