languageserver

package
v0.21.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertResultIntoDiagnostic added in v0.9.11

func ConvertResultIntoDiagnostic(vacuumResult *model.RuleFunctionResult) protocol.Diagnostic

func ConvertResultsIntoDiagnostics added in v0.9.11

func ConvertResultsIntoDiagnostics(result *motor.RuleSetExecutionResult) []protocol.Diagnostic

func GetDiagnosticSeverityFromRule added in v0.9.11

func GetDiagnosticSeverityFromRule(rule *model.Rule) protocol.DiagnosticSeverity

Types

type Document

type Document struct {
	URI               protocol.DocumentUri
	RunningDiagnostic bool
	Content           string
}

type DocumentContext added in v0.20.3

type DocumentContext struct {
	Content  []byte
	Filename string
	URI      string
}

DocumentContext contains details about the file being processed by the LSP. This allows you to add logic to the RulesetSelector based on the file name or content of the document being processed.

type DocumentStore

type DocumentStore struct {
	// contains filtered or unexported fields
}

func (*DocumentStore) Add

func (s *DocumentStore) Add(uri string, content string) *Document

func (*DocumentStore) Get

func (s *DocumentStore) Get(uri string) (*Document, bool)

func (*DocumentStore) Remove

func (s *DocumentStore) Remove(uri string)

type RulesetSelector added in v0.20.3

type RulesetSelector func(ctx *DocumentContext) *rulesets.RuleSet

RulesetSelector is used in NewServerWithRulesetSelector to allow you to dynamically return what rules should be used for the language server diagnostics based on the actual content of the OpenAPI spec being procesed.

type ServerState

type ServerState struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(version string, lintRequest *utils.LintFileRequest) *ServerState

func NewServerWithRulesetSelector added in v0.20.3

func NewServerWithRulesetSelector(version string, lintRequest *utils.LintFileRequest, selector RulesetSelector) *ServerState

NewServerWithRulesetSelector creates a new instance of the language server with a custom RulsetSelector function to allow you to dynamically select the ruleset used based on the content of the spec being processed.

This allows you to determine specifically what rules should be applied per spec, e.g.:

Have different teams which require different rules? Check the value of info.contact.name in the spec and return the relevant rules for that team.

Want to enable OWASP rules for only a specific server? Check the value of servers[0].url and return the rules including the OWASP ruleset for your specific super secure sever url.

func (*ServerState) Run

func (s *ServerState) Run() error

Jump to

Keyboard shortcuts

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