mirror of
https://github.com/sbt/sbt.git
synced 2026-09-04 16:54:29 +02:00
feat: add in actions() to Problem
This adds a new field into `xsbti.Problem` allowing for the compiler to forward "actions" that can address diagnostics. The idea largely mimics a very minimal `CodeAction` that can be found in the [LSP Spec](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#codeAction) in order to ensure it will work with a variety of difference clients that use LSP, and those that don't. In the future the `WorkspaceEdit` that was created here could also be expanded to handle more advanced changes, aka resource operations, like creating/moving/deleting files. For now we only focus on a small subset of these features.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* sbt
|
||||
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package xsbti;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* An Action is very miminal representation of a `CodeAction` in the LSP protocol.
|
||||
*
|
||||
* <p>However it only focuses on the actual title, description, and edit, leaving it up to the
|
||||
* language server to communicate with the client and put together a proper codeAction in accordance
|
||||
* to client capabilities.
|
||||
*
|
||||
* @see <a href=
|
||||
* "https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#codeAction">`CodeAction`</a>
|
||||
*/
|
||||
public interface Action {
|
||||
|
||||
/** Title of the action that will be shown to the user client side. */
|
||||
String title();
|
||||
|
||||
/** Optional description that may be shown to the user client side to explain the action. */
|
||||
Optional<String> description();
|
||||
|
||||
/** The actual edit contained in the action. */
|
||||
WorkspaceEdit edit();
|
||||
}
|
||||
Reference in New Issue
Block a user