Skip to content

Commit 1ad195c

Browse files
razzmatazzKrzysztof-Cieslak
authored andcommitted
Map CodeAction.IsPreferred & CodeAction.Disabled props.
1 parent 55d2f2f commit 1ad195c

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/LanguageServerProtocol.fs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,6 +1770,14 @@ module Types =
17701770
Diagnostics: Diagnostic[]
17711771
}
17721772

1773+
type CodeActionDisabled = {
1774+
/// Human readable description of why the code action is currently
1775+
/// disabled.
1776+
///
1777+
/// This is displayed in the code actions UI.
1778+
Reason: string
1779+
}
1780+
17731781
/// A code action represents a change that can be performed in code, e.g. to fix a problem or
17741782
/// to refactor code.
17751783
///
@@ -1786,6 +1794,35 @@ module Types =
17861794
/// The diagnostics that this code action resolves.
17871795
Diagnostics: Diagnostic[] option
17881796

1797+
/// Marks this as a preferred action. Preferred actions are used by the
1798+
/// `auto fix` command and can be targeted by keybindings.
1799+
///
1800+
/// * A quick fix should be marked preferred if it properly addresses the
1801+
/// underlying error. A refactoring should be marked preferred if it is the
1802+
/// most reasonable choice of actions to take.
1803+
///
1804+
/// * @since 3.15.0
1805+
IsPreferred: bool option
1806+
1807+
/// Marks that the code action cannot currently be applied.
1808+
///
1809+
/// Clients should follow the following guidelines regarding disabled code
1810+
/// actions:
1811+
///
1812+
/// - Disabled code actions are not shown in automatic lightbulbs code
1813+
/// action menus.
1814+
///
1815+
/// - Disabled actions are shown as faded out in the code action menu when
1816+
/// the user request a more specific type of code action, such as
1817+
/// refactorings.
1818+
///
1819+
/// - If the user has a keybinding that auto applies a code action and only
1820+
/// a disabled code actions are returned, the client should show the user
1821+
/// an error message with `reason` in the editor.
1822+
///
1823+
/// @since 3.16.0
1824+
Disabled: CodeActionDisabled option
1825+
17891826
/// The workspace edit this code action performs.
17901827
Edit: WorkspaceEdit option
17911828

0 commit comments

Comments
 (0)