-
Notifications
You must be signed in to change notification settings - Fork 677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an option to disable the references CodeLens #1781
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -373,6 +373,11 @@ | |
"type": "boolean", | ||
"default": true, | ||
"description": "Specifes whether OmniSharp should use VS Code editor settings for C# code formatting (use of tabs, indentation size)." | ||
}, | ||
"omnisharp.showReferencesCodeLens": { | ||
"type": "boolean", | ||
"default": true, | ||
"description": "Specifies whether Omnisharp should show the references CodeLens" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about: "Specifies whether the references CodeLens should be shown". Remember that the extension isn't "OmniSharp". |
||
} | ||
} | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ import { toRange, toLocation } from '../omnisharp/typeConvertion'; | |
import AbstractProvider from './abstractProvider'; | ||
import * as protocol from '../omnisharp/protocol'; | ||
import * as serverUtils from '../omnisharp/utils'; | ||
import { Options } from '../omnisharp/options'; | ||
|
||
class OmniSharpCodeLens extends vscode.CodeLens { | ||
|
||
|
@@ -43,6 +44,13 @@ export default class OmniSharpCodeLensProvider extends AbstractProvider implemen | |
}; | ||
|
||
provideCodeLenses(document: vscode.TextDocument, token: vscode.CancellationToken): vscode.CodeLens[] | Thenable<vscode.CodeLens[]> { | ||
const options = Options.Read(); | ||
if (!options.showReferencesCodeLens) | ||
{ | ||
let arr: vscode.CodeLens[] = []; | ||
return arr; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't use just return |
||
} | ||
|
||
return serverUtils.currentFileMembersAsTree(this._server, { FileName: document.fileName }, token).then(tree => { | ||
let ret: vscode.CodeLens[] = []; | ||
tree.TopLevelTypeDefinitions.forEach(node => this._convertQuickFix(ret, document.fileName, node)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be "csharp.showReferencesCodeLens". The "omnisharp.*" prefixed settings are intended to be for OmniSharp itself (though we diverged in one or two cases).