Skip to content

Only resolve the code lens when then opened file is on test source path#997

Merged
jdneo merged 6 commits into
masterfrom
cs/codelens
May 21, 2020
Merged

Only resolve the code lens when then opened file is on test source path#997
jdneo merged 6 commits into
masterfrom
cs/codelens

Conversation

@jdneo

@jdneo jdneo commented May 18, 2020

Copy link
Copy Markdown
Member

No description provided.

@jdneo jdneo added this to the 0.22.5 milestone May 18, 2020
@jdneo jdneo requested review from Eskibear and testforstephen May 18, 2020 07:24
Eskibear
Eskibear previously approved these changes May 18, 2020
testforstephen
testforstephen previously approved these changes May 19, 2020
@jdneo jdneo dismissed stale reviews from testforstephen and Eskibear via 2b5904b May 20, 2020 08:08
Comment thread src/testFileWatcher.ts Outdated
private registerListenersDebounce: (() => Promise<void>) & _.Cancelable = _.debounce(this.registerListenersInternal, 2 * 1000 /*ms*/);

public async registerListeners(): Promise<void> {
public async registerListeners(debounce: boolean = true): Promise<void> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about change the default to false? so if you want to register directly, then just call registerListeners(), that looks more natural to me.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Comment thread src/codelens/TestCodeLensProvider.ts Outdated
}

public async provideCodeLenses(document: TextDocument, _token: CancellationToken): Promise<CodeLens[]> {
if (!testFileWatcher.isOnTestSourcePath(document.uri.fsPath)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About filter the codelens, it seems vscode supports glob pattern on whether to trigger codelens.

	export interface DocumentFilter {

		/**
		 * A language id, like `typescript`.
		 */
		language?: string;

		/**
		 * A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
		 */
		scheme?: string;

		/**
		 * A [glob pattern](#GlobPattern) that is matched on the absolute path of the document. Use a [relative pattern](#RelativePattern)
		 * to filter documents to a [workspace folder](#WorkspaceFolder).
		 */
		pattern?: GlobPattern;
	}

testforstephen
testforstephen previously approved these changes May 21, 2020
@jdneo jdneo merged commit 048ec5f into master May 21, 2020
@jdneo jdneo deleted the cs/codelens branch May 21, 2020 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants