-
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
Fixed disabling of code lens references #1782
Changes from 2 commits
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 |
---|---|---|
|
@@ -28,12 +28,14 @@ class OmniSharpCodeLens extends vscode.CodeLens { | |
export default class OmniSharpCodeLensProvider extends AbstractProvider implements vscode.CodeLensProvider { | ||
|
||
private _testManager: TestManager; | ||
private _options: Options; | ||
|
||
constructor(server: OmniSharpServer, reporter: TelemetryReporter, testManager: TestManager) | ||
{ | ||
super(server, reporter); | ||
|
||
this._testManager = testManager; | ||
this._options = Options.Read(); | ||
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. With this change, do we still turn codelens on/off as you switch between the prefernces tab and file? 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. I don't think so. I would expect that this will require a restart of the extension to take effect. 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. yeah indeed. Though I think this is consistent with the rest of the extension at the moment - we don't read any options in "real time" I think 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. I think we're just inconsistent. For example, setting 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. thanks for the tip - I did not see that before. I pushed the appropriate change. Indeed, the experience is much nicer now 👍 |
||
} | ||
|
||
private static filteredSymbolNames: { [name: string]: boolean } = { | ||
|
@@ -44,8 +46,7 @@ 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) | ||
if (!this._options.showReferencesCodeLens && !this._options.showTestsCodeLens) | ||
{ | ||
return []; | ||
} | ||
|
@@ -64,13 +65,17 @@ export default class OmniSharpCodeLensProvider extends AbstractProvider implemen | |
} | ||
|
||
let lens = new OmniSharpCodeLens(fileName, toRange(node.Location)); | ||
bucket.push(lens); | ||
if (this._options.showReferencesCodeLens) { | ||
bucket.push(lens); | ||
} | ||
|
||
for (let child of node.ChildNodes) { | ||
this._convertQuickFix(bucket, fileName, child); | ||
} | ||
|
||
this._updateCodeLensForTest(bucket, fileName, node); | ||
if (this._options.showTestsCodeLens) { | ||
this._updateCodeLensForTest(bucket, fileName, node); | ||
} | ||
} | ||
|
||
resolveCodeLens(codeLens: vscode.CodeLens, token: vscode.CancellationToken): Thenable<vscode.CodeLens> { | ||
|
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.
Typo: "should be should". It looks like the same typo appears above.
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.
fixed!