mirror of
https://github.com/laravel-ls/protocol.git
synced 2026-06-16 03:54:56 +02:00
Initial commit
This commit is contained in:
commit
9061064e97
21 changed files with 1699 additions and 0 deletions
41
progress.go
Normal file
41
progress.go
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
package protocol
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
// ProgressToken - A token that can be used to report work done progress.
|
||||
// Can be a string or a number.
|
||||
//
|
||||
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#progress
|
||||
type ProgressToken struct {
|
||||
name string
|
||||
number int32
|
||||
}
|
||||
|
||||
func (v *ProgressToken) MarshalJSON() ([]byte, error) {
|
||||
if v.name != "" {
|
||||
return json.Marshal(v.name)
|
||||
}
|
||||
|
||||
return json.Marshal(v.number)
|
||||
}
|
||||
|
||||
func (v *ProgressToken) UnmarshalJSON(data []byte) error {
|
||||
*v = ProgressToken{}
|
||||
if err := json.Unmarshal(data, &v.number); err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return json.Unmarshal(data, &v.name)
|
||||
}
|
||||
|
||||
// WorkDoneProgressParams - is a parameter property of report work done progress.
|
||||
type WorkDoneProgressParams struct {
|
||||
// WorkDoneToken an optional token that a server can use to report work done progress.
|
||||
WorkDoneToken *ProgressToken `json:"workDoneToken,omitempty"`
|
||||
}
|
||||
|
||||
// PartialResultParams - allows for partial results in responses.
|
||||
type PartialResultParams struct {
|
||||
// PartialResultToken is a token for handling partial result updates.
|
||||
PartialResultToken *ProgressToken `json:"partialResultToken,omitempty"`
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue