langserver

package
v0.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotFoundError = fmt.Errorf("File not found in cache")

Functions

func ComputeTextEdits

func ComputeTextEdits(unformatted string, formatted string) []lsp.TextEdit

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

func Run

func Run(ctx context.Context, stream jsonrpc2.Stream, opts ...interface{}) error

Types

type Cache added in v0.0.7

type Cache struct {
	Files map[lsp.DocumentURI]string
	Lock  *sync.Mutex
}

func NewCache added in v0.0.7

func NewCache() *Cache

func (*Cache) Get added in v0.0.7

func (c *Cache) Get(uri lsp.DocumentURI) (string, error)

func (*Cache) Set added in v0.0.7

func (c *Cache) Set(uri lsp.DocumentURI, content string)

type FormatSettings added in v0.0.14

type FormatSettings struct {
	Mode string
}

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 (ls *LangServer) CodeLensResolve(ctx context.Context, params *lsp.CodeLens) (*lsp.CodeLens, error)

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 (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) Exit

func (ls *LangServer) Exit(ctx context.Context) 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) 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) 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) Shutdown

func (ls *LangServer) Shutdown(ctx context.Context) error

func (*LangServer) SignatureHelp

func (ls *LangServer) SignatureHelp(ctx context.Context, params *lsp.TextDocumentPositionParams) (*lsp.SignatureHelp, error)

func (*LangServer) Symbols

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 Settings added in v0.0.14

type Settings struct {
	Yolol YololSettings
}

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

func (*Settings) Read added in v0.0.14

func (s *Settings) Read(inp interface{}) error

type StdioStream

type StdioStream struct {
	Log bool
	// contains filtered or unexported fields
}

func NewStdioStream

func NewStdioStream() *StdioStream

func (*StdioStream) Read

func (s *StdioStream) Read(ctx context.Context) ([]byte, error)

ReadObject implements ObjectCodec.

func (*StdioStream) Write

func (s *StdioStream) Write(ctx context.Context, data []byte) error

type YololSettings added in v0.0.14

type YololSettings struct {
	Formatting FormatSettings
}

YololSettings contains settings specific to yolol

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL