1
0
Fork 0
mirror of https://github.com/laravel-ls/protocol.git synced 2026-06-17 20:40:04 +02:00

add window features structs and types

This commit is contained in:
Henrik Hautakoski 2026-03-01 22:27:56 +01:00
parent 9988e59b6c
commit 5049160990
3 changed files with 141 additions and 1 deletions

View file

@ -1,5 +1,28 @@
package protocol
// ShowDocumentClientCapabilities - Client capabilities for the show document request.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#showDocumentClientCapabilities
//
// @since 3.16.0
type ShowDocumentClientCapabilities struct {
// The client has support for the show document request.
Support bool `json:"support"`
}
// WindowClientCapabilities - Client capabilities for window features.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#windowClientCapabilities
type WindowClientCapabilities struct {
// It indicates whether the client supports the `window/showDocument` request.
//
// @since 3.16.0
ShowDocument *ShowDocumentClientCapabilities `json:"showDocument,omitempty"`
}
// ClientCapabilities defines the capabilities of the client (e.g., editor or IDE).
// It tells the language server what features the client supports.
type ClientCapabilities struct{}
type ClientCapabilities struct {
// Window specific client capabilities.
Window *WindowClientCapabilities `json:"window,omitempty"`
}

View file

@ -2,6 +2,11 @@ package protocol
import "encoding/json"
const (
MethodWindowWorkDoneProgressCreate = "window/workDoneProgress/create"
MethodWindowWorkDoneProgressCancel = "window/workDoneProgress/cancel"
)
// ProgressToken - A token that can be used to report work done progress.
// Can be a string or a number.
//
@ -39,3 +44,23 @@ type PartialResultParams struct {
// PartialResultToken is a token for handling partial result updates.
PartialResultToken *ProgressToken `json:"partialResultToken,omitempty"`
}
// WorkDoneProgressCreateParams - The parameters of a work done progress create request.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workDoneProgressCreateParams
//
// @since 3.15.0
type WorkDoneProgressCreateParams struct {
// The token to be used to report progress.
Token ProgressToken `json:"token"`
}
// WorkDoneProgressCancelParams - The parameters of a work done progress cancel notification.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workDoneProgressCancelParams
//
// @since 3.15.0
type WorkDoneProgressCancelParams struct {
// The token to be used to report progress.
Token ProgressToken `json:"token"`
}

92
window.go Normal file
View file

@ -0,0 +1,92 @@
package protocol
const (
MethodWindowLogMessage = "window/logMessage"
MethodWindowShowMessage = "window/showMessage"
MethodWindowShowMessageRequest = "window/showMessageRequest"
MethodWindowShowDocument = "window/showDocument"
)
// ShowMessageParams - The parameters of a show message notification.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#showMessageParams
type ShowMessageParams struct {
// The message type. See `MessageType`.
Type MessageType `json:"type"`
// The actual message.
Message string `json:"message"`
}
// ShowMessageRequestParams - The parameters of a show message request.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#showMessageRequestParams
type ShowMessageRequestParams struct {
ShowMessageParams
// The message action items to present.
Actions []MessageActionItem `json:"actions,omitempty"`
}
// MessageActionItem - A response item for a show message request.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#messageActionItem
type MessageActionItem struct {
// A short title like 'Retry', 'Open Log' etc.
Title string `json:"title"`
}
// LogMessageParams - The parameters of a log message notification.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#logMessageParams
type LogMessageParams struct {
ShowMessageParams
}
// ShowDocumentParams - Parameters for a show document request.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#showDocumentParams
//
// @since 3.16.0
type ShowDocumentParams struct {
// The URI to show.
URI DocumentURI `json:"uri"`
// Indicates if the editor should take focus.
TakeFocus *bool `json:"takeFocus,omitempty"`
// Indicates if the URI should be opened in an external program.
External *bool `json:"external,omitempty"`
// An optional selection range if the document is a text document.
Selection *Range `json:"selection,omitempty"`
}
// ShowDocumentResult - Result of a show document request.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#showDocumentResult
//
// @since 3.16.0
type ShowDocumentResult struct {
// Indicates whether the document was shown.
Success bool `json:"success"`
}
// MessageType - The message type.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#messageType
type MessageType int
const (
// An error message.
MessageTypeError MessageType = 1
// A warning message.
MessageTypeWarning MessageType = 2
// An information message.
MessageTypeInfo MessageType = 3
// A log message.
MessageTypeLog MessageType = 4
)