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

API Finalization -- Support for Notebook CodeActionKind #193120

Closed
Yoyokrazy opened this issue Sep 14, 2023 · 0 comments · Fixed by #193121
Closed

API Finalization -- Support for Notebook CodeActionKind #193120

Yoyokrazy opened this issue Sep 14, 2023 · 0 comments · Fixed by #193121
Assignees
Labels
api-finalization insiders-released Patch has been released in VS Code Insiders on-testplan

Comments

@Yoyokrazy
Copy link
Contributor

Yoyokrazy commented Sep 14, 2023

Fixes: #179213

Issue to document the final state of the Notebook CodeActionKind. Current proposition is as follows:

  • A new top level kind will be introduced as notebook.xyz, referenced as CodeActionKind.Notebook for extension authors and core usage
  • If a notebook CodeAction is called against a notebook, it will ONLY be called against the first cell of the notebook, and will precede the standard source CodeActions that will run against each cell in asynchronously. This is to ensure that all edits involving multiple cells will be addressed before any per cell action is taken. (ex: move all imports to top of notebook, normalize variable names, source.organizeImports, etc.)
  • Extension authors will be recommended via documentation in vscode.d.ts to use one of the following notations to create their kind:
    • CodeActionKind.Notebook.append(CodeActionKind.Source.append('normalizeVariableNames.ghinb').value)
    • CodeActionKind.Notebook.append('source.normalizeVariableNames')
    • The following also works, but is less explicit:
      • CodeActionKind.Empty.append('notebook.source.normalizeVariableNames')
  • Extension authors will be expected to register their provider with an adequate DocumentSelector, as well as CodeActionProviderMetadata that contains the field providedCodeActionKinds: readonly CodeActionKind[]

The following will be added to vscode.d.ts:

export class CodeActionKind {

	/**
	 * Base kind for all code actions applying to the enitre notebook's scope. CodeActionKinds using
	 * this should always begin with `notebook.`
	 *
	 * This requires that new CodeActions be created for it and contributed via extensions.
	 * Pre-existing kinds can not just have the new `notebook.` prefix added to them, as the functionality
	 * is unique to the full-notebook scope.
	 * 
	 * Notebook CodeActionKinds can be initialized as either of the following (both resulting in `notebook.source.xyz`):
	 * - `const newKind =  CodeActionKind.Notebook.append(CodeActionKind.Source.append('xyz').value)`
	 * - `const newKind =  CodeActionKind.Notebook.append('source.xyz')`
	 *
	 * Example Kinds/Actions:
	 * - `notebook.source.organizeImports` (might move all imports to a new top cell)
	 * - `notebook.source.normalizeVariableNames` (might rename all variables to a standardized casing format)
	 */
	static readonly Notebook: CodeActionKind;

	constructor(value: string);
}

thank you

@Yoyokrazy Yoyokrazy added this to the September 2023 milestone Sep 14, 2023
@Yoyokrazy Yoyokrazy self-assigned this Sep 14, 2023
@vscodenpa vscodenpa added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Sep 15, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Oct 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-finalization insiders-released Patch has been released in VS Code Insiders on-testplan
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants