Skip to content

Commit

Permalink
feat: code lens for references (denoland#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsonk authored and LumaKernel committed Feb 6, 2021
1 parent 614b67d commit fd62f42
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
14 changes: 14 additions & 0 deletions client/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@ export function cache(
};
}

export function showReferences(
_content: ExtensionContext,
client: LanguageClient,
): Callback {
return (uri: string, position: Position, locations: Location[]) => {
commands.executeCommand(
"editor.action.showReferences",
Uri.parse(uri),
client.protocol2CodeConverter.asPosition(position),
locations.map(client.protocol2CodeConverter.asLocation),
);
};
}

/** Open and display the "virtual document" which provides the status of the
* Deno Language Server. */
/*
Expand Down
22 changes: 21 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,26 @@
false
]
},
"deno.codeLens.references": {
"type": "boolean",
"default": false,
"markdownDescription": "Enables or disables the display of code lens information for references of items in the code.",
"scope": "window",
"examples": [
true,
false
]
},
"deno.codeLens.referencesAllFunctions": {
"type": "boolean",
"default": false,
"markdownDescription": "Enables or disables the display of code lens information for all functions in the code.",
"scope": "window",
"examples": [
true,
false
]
},
"deno.config": {
"type": "string",
"default": null,
Expand Down Expand Up @@ -144,4 +164,4 @@
"webpack": "^5.17.0",
"webpack-cli": "^4.4.0"
}
}
}
2 changes: 1 addition & 1 deletion typescript-deno-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Plugin implements ts.server.PluginModule {
// );
return scriptFiles;
});

const findRenameLocations = (
fileName: string,
position: number,
Expand Down

0 comments on commit fd62f42

Please sign in to comment.