Documentation ¶
Index ¶
- Constants
- Variables
- func ComputeTextEdits(unformatted string, formatted string) []lsp.TextEdit
- func Run(ctx context.Context, stream jsonrpc2.Stream, enableHotkeys bool, ...) error
- type Cache
- type DiagnosticResults
- type FormatSettings
- type LangServer
- func (ls *LangServer) CodeAction(ctx context.Context, params *lsp.CodeActionParams) ([]lsp.CodeAction, error)
- func (ls *LangServer) CodeLens(ctx context.Context, params *lsp.CodeLensParams) ([]lsp.CodeLens, error)
- func (ls *LangServer) CodeLensResolve(ctx context.Context, params *lsp.CodeLens) (*lsp.CodeLens, error)
- func (ls *LangServer) ColorPresentation(ctx context.Context, params *lsp.ColorPresentationParams) ([]lsp.ColorPresentation, error)
- func (ls *LangServer) Completion(ctx context.Context, params *lsp.CompletionParams) (*lsp.CompletionList, error)
- func (ls *LangServer) CompletionResolve(ctx context.Context, params *lsp.CompletionItem) (*lsp.CompletionItem, error)
- func (ls *LangServer) Definition(ctx context.Context, params *lsp.TextDocumentPositionParams) ([]lsp.Location, error)
- func (s *LangServer) Diagnose(ctx context.Context, uri lsp.DocumentURI)
- func (ls *LangServer) DidChange(ctx context.Context, params *lsp.DidChangeTextDocumentParams) error
- func (ls *LangServer) DidChangeConfiguration(ctx context.Context, params *lsp.DidChangeConfigurationParams) error
- func (ls *LangServer) DidChangeWatchedFiles(ctx context.Context, params *lsp.DidChangeWatchedFilesParams) error
- func (ls *LangServer) DidChangeWorkspaceFolders(ctx context.Context, params *lsp.DidChangeWorkspaceFoldersParams) error
- func (ls *LangServer) DidClose(ctx context.Context, params *lsp.DidCloseTextDocumentParams) error
- func (ls *LangServer) DidOpen(ctx context.Context, params *lsp.DidOpenTextDocumentParams) error
- func (ls *LangServer) DidSave(ctx context.Context, params *lsp.DidSaveTextDocumentParams) error
- func (ls *LangServer) DocumentColor(ctx context.Context, params *lsp.DocumentColorParams) ([]lsp.ColorInformation, error)
- func (ls *LangServer) DocumentHighlight(ctx context.Context, params *lsp.TextDocumentPositionParams) ([]lsp.DocumentHighlight, error)
- func (ls *LangServer) DocumentLink(ctx context.Context, params *lsp.DocumentLinkParams) ([]lsp.DocumentLink, error)
- func (ls *LangServer) DocumentLinkResolve(ctx context.Context, params *lsp.DocumentLink) (*lsp.DocumentLink, error)
- func (ls *LangServer) DocumentSymbol(ctx context.Context, params *lsp.DocumentSymbolParams) ([]lsp.DocumentSymbol, error)
- func (ls *LangServer) ExecuteCommand(ctx context.Context, params *lsp.ExecuteCommandParams) (interface{}, error)
- func (ls *LangServer) Exit(ctx context.Context) error
- func (ls *LangServer) FoldingRanges(ctx context.Context, params *lsp.FoldingRangeRequestParam) ([]lsp.FoldingRange, error)
- func (s *LangServer) Format(params *lsp.DocumentFormattingParams) ([]lsp.TextEdit, error)
- func (ls *LangServer) Formatting(ctx context.Context, params *lsp.DocumentFormattingParams) ([]lsp.TextEdit, error)
- func (s *LangServer) GetCompletions(params *lsp.CompletionParams) (*lsp.CompletionList, error)
- func (ls *LangServer) Hover(ctx context.Context, params *lsp.TextDocumentPositionParams) (*lsp.Hover, error)
- func (ls *LangServer) Implementation(ctx context.Context, params *lsp.TextDocumentPositionParams) ([]lsp.Location, error)
- func (ls *LangServer) Initialize(ctx context.Context, params *lsp.InitializeParams) (*lsp.InitializeResult, error)
- func (ls *LangServer) Initialized(ctx context.Context, params *lsp.InitializedParams) error
- func (ls *LangServer) ListenForHotkeys()
- func (ls *LangServer) OnTypeFormatting(ctx context.Context, params *lsp.DocumentOnTypeFormattingParams) ([]lsp.TextEdit, error)
- func (ls *LangServer) RangeFormatting(ctx context.Context, params *lsp.DocumentRangeFormattingParams) ([]lsp.TextEdit, error)
- func (ls *LangServer) References(ctx context.Context, params *lsp.ReferenceParams) ([]lsp.Location, error)
- func (ls *LangServer) Rename(ctx context.Context, params *lsp.RenameParams) ([]lsp.WorkspaceEdit, error)
- func (ls *LangServer) Shutdown(ctx context.Context) error
- func (ls *LangServer) SignatureHelp(ctx context.Context, params *lsp.TextDocumentPositionParams) (*lsp.SignatureHelp, error)
- func (ls *LangServer) Symbols(ctx context.Context, params *lsp.WorkspaceSymbolParams) ([]lsp.SymbolInformation, error)
- func (ls *LangServer) TypeDefinition(ctx context.Context, params *lsp.TextDocumentPositionParams) ([]lsp.Location, error)
- func (ls *LangServer) WillSave(ctx context.Context, params *lsp.WillSaveTextDocumentParams) error
- func (ls *LangServer) WillSaveWaitUntil(ctx context.Context, params *lsp.WillSaveTextDocumentParams) ([]lsp.TextEdit, error)
- type LengthCheckSettings
- type Settings
- type StdioStream
- type YololSettings
Constants ¶
const ( FormatModeSpaceless = "Spaceless" FormatModeCompact = "Compact" FormatModeReadale = "Readable" LengthCheckModeStrict = "Strict" LengthCheckModeOptimize = "Optimize" LengthCheckModeOff = "Off" )
Variables ¶
var DefaultNololCompletions = []lsp.CompletionItem{
{
Label: "if",
Kind: 14,
},
{
Label: "then",
Kind: 14,
},
{
Label: "else",
Kind: 14,
},
{
Label: "end",
Kind: 14,
},
{
Label: "goto",
Kind: 14,
},
{
Label: "while",
Kind: 14,
},
{
Label: "do",
Kind: 14,
},
{
Label: "continue",
Kind: 14,
},
{
Label: "break",
Kind: 14,
},
{
Label: "define",
Kind: 14,
},
{
Label: "include",
Kind: 14,
},
{
Label: "macro",
Kind: 14,
},
{
Label: "not",
Detail: "not X",
Kind: 24,
Documentation: "Returns 1 if X is 0, otherwise it returns 0",
},
{
Label: "and",
Detail: "X and Y",
Kind: 24,
Documentation: "Returns true if X and Y are true",
},
{
Label: "or",
Detail: "X or Y",
Kind: 24,
Documentation: "Returns true if X or Y are true",
},
{
Label: "abs",
Detail: "abs(X)",
InsertText: "abs(${1:x})$0",
InsertTextFormat: 2,
Kind: 3,
Documentation: "Returns the absolute value of X",
},
{
Label: "sqrt",
Detail: "sqrt(X)",
InsertText: "sqrt(${1:x})$0",
InsertTextFormat: 2,
Kind: 3,
Documentation: "Returns the square-root of X",
},
{
Label: "sin",
Detail: "sin(X)",
InsertText: "sin(${1:x})$0",
InsertTextFormat: 2,
Kind: 3,
Documentation: "Returns the sine (degree) of X",
},
{
Label: "cos",
Detail: "cos(X)",
InsertText: "cos(${1:x})$0",
InsertTextFormat: 2,
Kind: 3,
Documentation: "Returns the cosine (degree) of X",
},
{
Label: "tan",
Detail: "tan(X)",
InsertText: "tan(${1:x})$0",
InsertTextFormat: 2,
Kind: 3,
Documentation: "Returns the tangent (degree) of X",
},
{
Label: "asin",
Detail: "asin(X)",
InsertText: "asin(${1:x})$0",
InsertTextFormat: 2,
Kind: 3,
Documentation: "Returns the inverse sine (degree) of X",
},
{
Label: "acos",
Detail: "acos(X)",
InsertText: "acos(${1:x})$0",
InsertTextFormat: 2,
Kind: 3,
Documentation: "Returns the inverse cosine (degree) of X",
},
{
Label: "atan",
Detail: "atan(X)",
InsertText: "atan(${1:x})$0",
InsertTextFormat: 2,
Kind: 3,
Documentation: "Returns the inverse tangent (degree) of X",
},
}
DefaultNololCompletions contains completion-items for nolol-builtins
var DefaultYololCompletions = []lsp.CompletionItem{
{
Label: "if",
Kind: 14,
},
{
Label: "then",
Kind: 14,
},
{
Label: "else",
Kind: 14,
},
{
Label: "end",
Kind: 14,
},
{
Label: "goto",
Kind: 14,
},
{
Label: "not",
Detail: "not X",
Kind: 24,
Documentation: "Returns 1 if X is 0, otherwise it returns 0",
},
{
Label: "and",
Detail: "X and Y",
Kind: 24,
Documentation: "Returns true if X and Y are true",
},
{
Label: "or",
Detail: "X or Y",
Kind: 24,
Documentation: "Returns true if X or Y are true",
},
{
Label: "abs",
Detail: "abs X",
Kind: 3,
Documentation: "Returns the absolute value of X",
},
{
Label: "sqrt",
Detail: "sqrt X",
Kind: 3,
Documentation: "Returns the square-root of X",
},
{
Label: "sin",
Detail: "sin X",
Kind: 3,
Documentation: "Returns the sine (degree) of X",
},
{
Label: "cos",
Detail: "cos X",
Kind: 3,
Documentation: "Returns the cosine (degree) of X",
},
{
Label: "tan",
Detail: "tan X",
Kind: 3,
Documentation: "Returns the tangent (degree) of X",
},
{
Label: "asin",
Detail: "asin X",
Kind: 3,
Documentation: "Returns the inverse sine (degree) of X",
},
{
Label: "acos",
Detail: "acos X",
Kind: 3,
Documentation: "Returns the inverse cosine (degree) of X",
},
{
Label: "atan",
Detail: "atan X",
Kind: 3,
Documentation: "Returns the inverse tangent (degree) of X",
},
}
DefaultYololCompletions contains completion-items for yolol-builtins
var NotFoundError = fmt.Errorf("File not found in cache")
Functions ¶
func ComputeTextEdits ¶
ComputeTextEdits computes text edits that are required to change the `unformatted` to the `formatted` text. Blatantly stolen from https://github.com/sourcegraph/go-langserver/blob/master/langserver/format.go
Types ¶
type Cache ¶ added in v0.0.7
type Cache struct { Files map[lsp.DocumentURI]string Diagnostics map[lsp.DocumentURI]DiagnosticResults Lock *sync.Mutex LastOpenedYololFile lsp.DocumentURI }
func (*Cache) GetDiagnostics ¶ added in v0.0.24
func (c *Cache) GetDiagnostics(uri lsp.DocumentURI) (*DiagnosticResults, error)
func (*Cache) SetDiagnostics ¶ added in v0.0.24
func (c *Cache) SetDiagnostics(uri lsp.DocumentURI, content DiagnosticResults)
type DiagnosticResults ¶ added in v0.0.24
type DiagnosticResults struct { Variables []string AnalysisReport *nolol.AnalysisReport }
type FormatSettings ¶ added in v0.0.14
type FormatSettings struct {
Mode string `json:"mode"`
}
FormatSettings contains formatting settings
type LangServer ¶
type LangServer struct {
// contains filtered or unexported fields
}
func (*LangServer) CodeAction ¶
func (ls *LangServer) CodeAction(ctx context.Context, params *lsp.CodeActionParams) ([]lsp.CodeAction, error)
func (*LangServer) CodeLens ¶
func (ls *LangServer) CodeLens(ctx context.Context, params *lsp.CodeLensParams) ([]lsp.CodeLens, error)
func (*LangServer) CodeLensResolve ¶
func (*LangServer) ColorPresentation ¶
func (ls *LangServer) ColorPresentation(ctx context.Context, params *lsp.ColorPresentationParams) ([]lsp.ColorPresentation, error)
func (*LangServer) Completion ¶
func (ls *LangServer) Completion(ctx context.Context, params *lsp.CompletionParams) (*lsp.CompletionList, error)
func (*LangServer) CompletionResolve ¶
func (ls *LangServer) CompletionResolve(ctx context.Context, params *lsp.CompletionItem) (*lsp.CompletionItem, error)
func (*LangServer) Definition ¶
func (ls *LangServer) Definition(ctx context.Context, params *lsp.TextDocumentPositionParams) ([]lsp.Location, error)
func (*LangServer) Diagnose ¶
func (s *LangServer) Diagnose(ctx context.Context, uri lsp.DocumentURI)
func (*LangServer) DidChange ¶
func (ls *LangServer) DidChange(ctx context.Context, params *lsp.DidChangeTextDocumentParams) error
func (*LangServer) DidChangeConfiguration ¶
func (ls *LangServer) DidChangeConfiguration(ctx context.Context, params *lsp.DidChangeConfigurationParams) error
func (*LangServer) DidChangeWatchedFiles ¶
func (ls *LangServer) DidChangeWatchedFiles(ctx context.Context, params *lsp.DidChangeWatchedFilesParams) error
func (*LangServer) DidChangeWorkspaceFolders ¶
func (ls *LangServer) DidChangeWorkspaceFolders(ctx context.Context, params *lsp.DidChangeWorkspaceFoldersParams) error
func (*LangServer) DidClose ¶
func (ls *LangServer) DidClose(ctx context.Context, params *lsp.DidCloseTextDocumentParams) error
func (*LangServer) DidOpen ¶
func (ls *LangServer) DidOpen(ctx context.Context, params *lsp.DidOpenTextDocumentParams) error
func (*LangServer) DidSave ¶
func (ls *LangServer) DidSave(ctx context.Context, params *lsp.DidSaveTextDocumentParams) error
func (*LangServer) DocumentColor ¶
func (ls *LangServer) DocumentColor(ctx context.Context, params *lsp.DocumentColorParams) ([]lsp.ColorInformation, error)
func (*LangServer) DocumentHighlight ¶
func (ls *LangServer) DocumentHighlight(ctx context.Context, params *lsp.TextDocumentPositionParams) ([]lsp.DocumentHighlight, error)
func (*LangServer) DocumentLink ¶
func (ls *LangServer) DocumentLink(ctx context.Context, params *lsp.DocumentLinkParams) ([]lsp.DocumentLink, error)
func (*LangServer) DocumentLinkResolve ¶
func (ls *LangServer) DocumentLinkResolve(ctx context.Context, params *lsp.DocumentLink) (*lsp.DocumentLink, error)
func (*LangServer) DocumentSymbol ¶
func (ls *LangServer) DocumentSymbol(ctx context.Context, params *lsp.DocumentSymbolParams) ([]lsp.DocumentSymbol, error)
func (*LangServer) ExecuteCommand ¶
func (ls *LangServer) ExecuteCommand(ctx context.Context, params *lsp.ExecuteCommandParams) (interface{}, error)
func (*LangServer) FoldingRanges ¶
func (ls *LangServer) FoldingRanges(ctx context.Context, params *lsp.FoldingRangeRequestParam) ([]lsp.FoldingRange, error)
func (*LangServer) Format ¶ added in v0.0.7
func (s *LangServer) Format(params *lsp.DocumentFormattingParams) ([]lsp.TextEdit, error)
Format computes formatting instructions for the given document. Parser errors during formatting are silently discared, as reporting them to the user would just be annoying and showing errors is already done by the diagnostics
func (*LangServer) Formatting ¶
func (ls *LangServer) Formatting(ctx context.Context, params *lsp.DocumentFormattingParams) ([]lsp.TextEdit, error)
func (*LangServer) GetCompletions ¶ added in v0.0.24
func (s *LangServer) GetCompletions(params *lsp.CompletionParams) (*lsp.CompletionList, error)
func (*LangServer) Hover ¶
func (ls *LangServer) Hover(ctx context.Context, params *lsp.TextDocumentPositionParams) (*lsp.Hover, error)
func (*LangServer) Implementation ¶
func (ls *LangServer) Implementation(ctx context.Context, params *lsp.TextDocumentPositionParams) ([]lsp.Location, error)
func (*LangServer) Initialize ¶
func (ls *LangServer) Initialize(ctx context.Context, params *lsp.InitializeParams) (*lsp.InitializeResult, error)
func (*LangServer) Initialized ¶
func (ls *LangServer) Initialized(ctx context.Context, params *lsp.InitializedParams) error
func (*LangServer) ListenForHotkeys ¶ added in v0.0.29
func (ls *LangServer) ListenForHotkeys()
ListenForHotkeys is only supported on windows
func (*LangServer) OnTypeFormatting ¶
func (ls *LangServer) OnTypeFormatting(ctx context.Context, params *lsp.DocumentOnTypeFormattingParams) ([]lsp.TextEdit, error)
func (*LangServer) RangeFormatting ¶
func (ls *LangServer) RangeFormatting(ctx context.Context, params *lsp.DocumentRangeFormattingParams) ([]lsp.TextEdit, error)
func (*LangServer) References ¶
func (ls *LangServer) References(ctx context.Context, params *lsp.ReferenceParams) ([]lsp.Location, error)
func (*LangServer) Rename ¶
func (ls *LangServer) Rename(ctx context.Context, params *lsp.RenameParams) ([]lsp.WorkspaceEdit, error)
func (*LangServer) SignatureHelp ¶
func (ls *LangServer) SignatureHelp(ctx context.Context, params *lsp.TextDocumentPositionParams) (*lsp.SignatureHelp, error)
func (*LangServer) Symbols ¶
func (ls *LangServer) Symbols(ctx context.Context, params *lsp.WorkspaceSymbolParams) ([]lsp.SymbolInformation, error)
func (*LangServer) TypeDefinition ¶
func (ls *LangServer) TypeDefinition(ctx context.Context, params *lsp.TextDocumentPositionParams) ([]lsp.Location, error)
func (*LangServer) WillSave ¶
func (ls *LangServer) WillSave(ctx context.Context, params *lsp.WillSaveTextDocumentParams) error
func (*LangServer) WillSaveWaitUntil ¶
func (ls *LangServer) WillSaveWaitUntil(ctx context.Context, params *lsp.WillSaveTextDocumentParams) ([]lsp.TextEdit, error)
type LengthCheckSettings ¶ added in v0.0.18
type LengthCheckSettings struct {
Mode string `json:"mode"`
}
LengthCheckSettings contains settings for the lenght-validation
type Settings ¶ added in v0.0.14
type Settings struct {
Yolol YololSettings `json:"yolol"`
}
Settings contains settings for the language-server
func DefaultSettings ¶ added in v0.0.14
func DefaultSettings() *Settings
DefaultSettings returns the default-settings for the server
type StdioStream ¶
type StdioStream struct { Log bool // contains filtered or unexported fields }
func NewStdioStream ¶
func NewStdioStream() *StdioStream
type YololSettings ¶ added in v0.0.14
type YololSettings struct { Formatting FormatSettings `json:"formatting"` LengthChecking LengthCheckSettings `json:"lengthChecking"` ChipType string `json:"chipType"` }
YololSettings contains settings specific to yolol