Skip to content
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

Test: folding range provider event to signal that ranges have changed #109414

Closed
1 task done
aeschli opened this issue Oct 26, 2020 · 1 comment
Closed
1 task done

Test: folding range provider event to signal that ranges have changed #109414

aeschli opened this issue Oct 26, 2020 · 1 comment
Assignees
Milestone

Comments

@aeschli
Copy link
Contributor

aeschli commented Oct 26, 2020

Refs: #99914

Complexity: 3

Create Issue


Write a extension that test the new proposed API onDidChangeFoldingRanges

	export interface FoldingRangeProvider {

		/**
		 * An optional event to signal that the folding ranges from this provider have changed.
		 */
		onDidChangeFoldingRanges?: Event<void>;

		/**
		 * Returns a list of folding ranges or null and undefined if the provider
		 * does not want to participate or was cancelled.
		 * @param document The document in which the command was invoked.
		 * @param context Additional context information (for future use)
		 * @param token A cancellation token.
		 */
		provideFoldingRanges(document: TextDocument, context: FoldingContext, token: CancellationToken): ProviderResult<FoldingRange[]>;
	}
@bpasero
Copy link
Member

bpasero commented Oct 27, 2020

Verified using the following very simple extension code:

class MyProvider implements vscode.FoldingRangeProvider {

	_onDidChangeFoldingRangeEmitter = new vscode.EventEmitter<void>();
	onDidChangeFoldingRanges = this._onDidChangeFoldingRangeEmitter.event;

	constructor() {
		setInterval(() => {
			this._onDidChangeFoldingRangeEmitter.fire();
		}, 1000);
	}

	provideFoldingRanges(document: vscode.TextDocument, context: vscode.FoldingContext, token: vscode.CancellationToken): vscode.ProviderResult<vscode.FoldingRange[]> {
		console.log("provide ranges");

		return [];
	}
}

@bpasero bpasero closed this as completed Oct 27, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Dec 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants