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

Map CodeAction.IsPreferred & CodeAction.Disabled props. #4

Merged
merged 1 commit into from
Nov 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/LanguageServerProtocol.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,14 @@ module Types =
Diagnostics: Diagnostic[]
}

type CodeActionDisabled = {
/// Human readable description of why the code action is currently
/// disabled.
///
/// This is displayed in the code actions UI.
Reason: string
}

/// A code action represents a change that can be performed in code, e.g. to fix a problem or
/// to refactor code.
///
Expand All @@ -1671,6 +1679,35 @@ module Types =
/// The diagnostics that this code action resolves.
Diagnostics: Diagnostic[] option

/// Marks this as a preferred action. Preferred actions are used by the
/// `auto fix` command and can be targeted by keybindings.
///
/// * A quick fix should be marked preferred if it properly addresses the
/// underlying error. A refactoring should be marked preferred if it is the
/// most reasonable choice of actions to take.
///
/// * @since 3.15.0
IsPreferred: bool option

/// Marks that the code action cannot currently be applied.
///
/// Clients should follow the following guidelines regarding disabled code
/// actions:
///
/// - Disabled code actions are not shown in automatic lightbulbs code
/// action menus.
///
/// - Disabled actions are shown as faded out in the code action menu when
/// the user request a more specific type of code action, such as
/// refactorings.
///
/// - If the user has a keybinding that auto applies a code action and only
/// a disabled code actions are returned, the client should show the user
/// an error message with `reason` in the editor.
///
/// @since 3.16.0
Disabled: CodeActionDisabled option

/// The workspace edit this code action performs.
Edit: WorkspaceEdit option

Expand Down