{"modulePath":"github.com/GoCodeAlone/workflow","version":"v0.87.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package lsp\n\nPackage lsp implements a Language Server Protocol server for workflow configuration files, providing completions, diagnostics, and hover info.\n\n## Variables\n\n```go\nvar Version = \"dev\"\n```\nVersion is set at build time.\n\n## Functions\n\n```go\nfunc Completions(reg *Registry, doc *Document, ctx PositionContext) []protocol.CompletionItem\n```\nCompletions returns completion items for the given document and position context.\n\n```go\nfunc Diagnostics(reg *Registry, doc *Document) []protocol.Diagnostic\n```\nDiagnostics analyses a document and returns LSP diagnostics.\n\n```go\nfunc Hover(reg *Registry, doc *Document, ctx PositionContext) *protocol.Hover\n```\nHover returns markdown hover content for the given position context, or nil if there is nothing to show.\n\n## Types\n\n```go\ntype CompletionResult struct {\n\tLabel  string `json:\"label\"`\n\tKind   string `json:\"kind,omitempty\"`\n\tDetail string `json:\"detail,omitempty\"`\n}\n```\nCompletionResult is a single completion item returned by CompleteAt.\n\n```go\nfunc CompleteAt(content string, line, col int, pluginDir ...string) []CompletionResult\n```\nCompleteAt returns completion suggestions for the given content at (line, col). Both line and col are zero-based. An optional pluginDir can be provided.\n\n```go\ntype DSLSectionDoc struct {\n\tID          string\n\tTitle       string\n\tDescription string\n\tExample     string\n}\n```\nDSLSectionDoc holds abbreviated documentation for one DSL section, used for hover.\n\n```go\ntype DiagSeverity int\n```\nDiagSeverity is the severity level of a diagnostic message.\n\n```go\nconst (\n\t// SeverityError indicates a hard error that prevents correct operation.\n\tSeverityError DiagSeverity = 1\n\t// SeverityWarning indicates a potential issue.\n\tSeverityWarning DiagSeverity = 2\n\t// SeverityInformation indicates an informational message.\n\tSeverityInformation DiagSeverity = 3\n\t// SeverityHint indicates a hint or suggestion.\n\tSeverityHint DiagSeverity = 4\n)\n```\n\n```go\ntype Diagnostic struct {\n\tLine     int          `json:\"line\"`\n\tCol      int          `json:\"col\"`\n\tEndLine  int          `json:\"end_line\"`\n\tEndCol   int          `json:\"end_col\"`\n\tMessage  string       `json:\"message\"`\n\tSeverity DiagSeverity `json:\"severity\"`\n\tSource   string       `json:\"source,omitempty\"`\n}\n```\nDiagnostic is a language-server-style diagnostic returned by DiagnoseContent.\n\n```go\nfunc DiagnoseContent(content string, pluginDir ...string) []Diagnostic\n```\nDiagnoseContent analyses YAML content in-process and returns diagnostics without requiring an LSP client connection. An optional pluginDir can be provided to load step schemas from external plugin manifests.\n\n```go\ntype Document struct {\n\tURI     string\n\tContent string\n\tNode    *yaml.Node // root node (Kind == DocumentNode)\n}\n```\nDocument holds the content and parsed state of an open YAML file.\n\n```go\ntype DocumentStore struct {\n\t// contains filtered or unexported fields\n}\n```\nDocumentStore is a thread-safe store of open LSP documents.\n\n```go\nfunc NewDocumentStore() *DocumentStore\n```\nNewDocumentStore creates an empty DocumentStore.\n\n```go\nfunc (ds *DocumentStore) Delete(uri string)\n```\nDelete removes a document from the store.\n\n```go\nfunc (ds *DocumentStore) Get(uri string) *Document\n```\nGet returns a document by URI, or nil if not found.\n\n```go\nfunc (ds *DocumentStore) Set(uri, content string) *Document\n```\nSet stores or replaces a document.\n\n```go\ntype FieldSchema struct {\n\tName        string         `json:\"name\"`\n\tType        string         `json:\"type\"`\n\tFormat      string         `json:\"format,omitempty\"`\n\tDescription string         `json:\"description,omitempty\"`\n\tRequired    bool           `json:\"required,omitempty\"`\n\tChildren    []*FieldSchema `json:\"children,omitempty\"`\n}\n```\nFieldSchema describes a single data field with rich metadata.\n\n```go\ntype HoverResult struct {\n\tContent string `json:\"content\"`\n}\n```\nHoverResult is the hover content returned by HoverAt.\n\n```go\nfunc HoverAt(content string, line, col int, pluginDir ...string) *HoverResult\n```\nHoverAt returns hover documentation for the given content at (line, col). Both line and col are zero-based. Returns nil if there is no hover info. An optional pluginDir can be provided.\n\n```go\ntype ModuleTypeInfo struct {\n\tType        string\n\tLabel       string\n\tCategory    string\n\tDescription string\n\tConfigKeys  []string\n}\n```\nModuleTypeInfo holds metadata about a known module type for the LSP.\n\n```go\ntype PipelineDataContext struct {\n\tPipelineName string                       `json:\"pipelineName\"`\n\tStepOrder    []string                     `json:\"stepOrder\"`\n\tSteps        map[string]*StepOutputSchema `json:\"steps\"`\n\tTrigger      *TriggerSchema               `json:\"trigger,omitempty\"`\n}\n```\nPipelineDataContext is the full set of context keys available at a given cursor position in a pipeline, combining trigger data with step outputs accumulated from all steps preceding the cursor.\n\n```go\nfunc BuildPipelineContext(reg *Registry, doc *Document, cursorLine int) *PipelineDataContext\n```\nBuildPipelineContext builds a PipelineDataContext for the pipeline that contains cursorLine (0-based). It uses yaml.Node.Line (1-based) internally to locate the pipeline and identify which steps precede the cursor.\n\nOpenAPI trigger schema is auto-discovered from a module with type containing \"openapi\" and a config.spec\\_file key. Method and path are read from the pipeline's own trigger: section. Falls back to a generic {type: \"http\"} trigger when no OpenAPI spec is found or matched.\n\n```go\ntype PositionContext struct {\n\tSection         SectionKind\n\tModuleType      string            // if inside a modules[] item config, the type value\n\tStepType        string            // if inside a pipeline step config, the step type value\n\tFieldName       string            // the field name at the cursor\n\tInTemplate      bool              // cursor is inside {{ }}\n\tInExpr          bool              // cursor is inside ${ }\n\tDependsOn       bool              // cursor is in a dependsOn array value\n\tPipelineName    string            // name of the pipeline containing the cursor (if any)\n\tCurrentStepName string            // name of the step containing the cursor (if any)\n\tTemplatePath    *TemplateExprPath // parsed template expression at cursor, if InTemplate or InExpr\n\tLine            int\n\tCharacter       int\n}\n```\nPositionContext describes what context the cursor is in within the document.\n\n```go\nfunc ContextAt(content string, line, char int) PositionContext\n```\nContextAt analyses the document content at the given (zero-based) line and character position and returns a PositionContext describing what the cursor is positioned on.\n\n```go\ntype Registry struct {\n\tModuleTypes   map[string]ModuleTypeInfo\n\tStepTypes     map[string]StepTypeInfo\n\tTriggerTypes  map[string]TriggerTypeInfo\n\tWorkflowTypes []string\n\tDSLSections   map[string]*DSLSectionDoc // section ID → parsed doc from dsl-reference.md\n}\n```\nRegistry aggregates all known workflow types for LSP use.\n\n```go\nfunc NewRegistry() *Registry\n```\nNewRegistry builds a Registry from the schema package's known types and registry.\n\n```go\ntype SectionKind string\n```\nSectionKind identifies the YAML section the cursor is in.\n\n```go\nconst (\n\tSectionUnknown  SectionKind = \"unknown\"\n\tSectionModules  SectionKind = \"modules\"\n\tSectionWorkflow SectionKind = \"workflows\"\n\tSectionTriggers SectionKind = \"triggers\"\n\tSectionPipeline SectionKind = \"pipelines\"\n\tSectionRequires SectionKind = \"requires\"\n\tSectionImports  SectionKind = \"imports\"\n\tSectionTopLevel SectionKind = \"top_level\"\n)\n```\n\n```go\ntype Server struct {\n\t// contains filtered or unexported fields\n}\n```\nServer is the workflow LSP server.\n\n```go\nfunc NewServer(pluginDir ...string) *Server\n```\nNewServer creates a new LSP server with all handlers registered. An optional pluginDir can be provided to load step schemas from external plugin manifests (plugin.json files).\n\n```go\nfunc (s *Server) RunStdio() error\n```\nRunStdio starts the LSP server over stdio (blocking).\n\n```go\ntype StepOutputSchema struct {\n\tStepName string                  `json:\"stepName\"`\n\tStepType string                  `json:\"stepType\"`\n\tFields   []schema.InferredOutput `json:\"fields\"`\n}\n```\nStepOutputSchema holds the inferred outputs for a completed pipeline step.\n\n```go\ntype StepTypeInfo struct {\n\tType        string\n\tDescription string\n\tConfigKeys  []string\n\tConfigDefs  []schema.ConfigFieldDef // rich per-key metadata\n\tOutputs     []schema.StepOutputDef  // step output keys\n}\n```\nStepTypeInfo holds metadata about a known step type for the LSP.\n\n```go\ntype TemplateExprPath struct {\n\tNamespace   string // \"steps\", \"trigger\", \"meta\", \"body\", or \"\" (top-level)\n\tStepName    string // if Namespace==\"steps\", the step name\n\tSubField    string // nested path within namespace (e.g. \"path_params\" for trigger, \"address\" for body)\n\tFieldPrefix string // partial field name being typed (for filtering)\n\tRaw         string // the raw expression text before cursor\n}\n```\nTemplateExprPath represents the parsed cursor position within a template expression.\n\n```go\nfunc ParseExprAt(line string, char int) *TemplateExprPath\n```\nParseExprAt parses the expr expression from a line up to the cursor position. Returns nil if the cursor is not inside a ${ } block. The returned TemplateExprPath uses the same fields as ParseTemplateExprAt but interprets expr syntax: \\`steps\\[\"name\"]\\[\"field\"]\\`, \\`body.field\\`, etc.\n\n```go\nfunc ParseTemplateExprAt(line string, char int) *TemplateExprPath\n```\nParseTemplateExprAt extracts and parses the template expression from a line up to the cursor position. Returns nil if cursor is not in a template expression.\n\n```go\ntype TriggerSchema struct {\n\tType        string         `json:\"type\"`\n\tPathParams  []*FieldSchema `json:\"pathParams,omitempty\"`\n\tQueryParams []*FieldSchema `json:\"queryParams,omitempty\"`\n\tBodyFields  []*FieldSchema `json:\"bodyFields,omitempty\"`\n\tHeaders     []*FieldSchema `json:\"headers,omitempty\"`\n}\n```\nTriggerSchema describes the data surfaced by the workflow trigger.\n\n```go\ntype TriggerTypeInfo struct {\n\tType        string\n\tDescription string\n}\n```\nTriggerTypeInfo holds metadata about a known trigger type.\n\n","path":"github.com/GoCodeAlone/workflow/lsp","name":"lsp","synopsis":"Package lsp implements a Language Server Protocol server for workflow configuration files, providing completions, diagnostics, and hover info.","isRedistributable":true}
