Documentation
¶
Index ¶
- func BuildFieldSchema(schema bigquery.Schema) []lsp.FieldSchema
- type Diagnostics
- type File
- type Project
- func (p *Project) Close() error
- func (p *Project) Complete(ctx context.Context, uri lsp.DocumentURI, position lsp.Position) ([]completion.CompletionItem, error)
- func (p *Project) DeleteFile(uri lsp.DocumentURI)
- func (p *Project) Diagnose(ctx context.Context, uri lsp.DocumentURI, cfg lint.Config) (Diagnostics, bool)
- func (p *Project) Dryrun(ctx context.Context, uri lsp.DocumentURI) (*bq.JobStatus, error)
- func (p *Project) GetFile(uri lsp.DocumentURI) (string, bool)
- func (p *Project) GetJobDetails(ctx context.Context, projectID, jobID, location string) ([]lsp.MarkedString, func(context.Context) (*bq.RowIterator, error), error)
- func (p *Project) GetJobInfo(ctx context.Context, projectID, jobID, location string) ([]lsp.MarkedString, *bq.RowIterator, error)
- func (p *Project) GetTableDetails(ctx context.Context, projectID, datasetID, tableID string) ([]lsp.MarkedString, []lsp.FieldSchema, ...)
- func (p *Project) GetTableInfo(ctx context.Context, projectID, datasetID, tableID string) ([]lsp.MarkedString, *bq.RowIterator, error)
- func (p *Project) InvalidateDiagnostics(uri lsp.DocumentURI)
- func (p *Project) LookupIdent(ctx context.Context, uri lsp.DocumentURI, position lsp.Position) ([]lsp.Location, error)
- func (p *Project) OpenFiles() []lsp.DocumentURI
- func (p *Project) ResolveCompletionItem(ctx context.Context, item lsp.CompletionItem) (lsp.CompletionItem, error)
- func (p *Project) Run(ctx context.Context, uri lsp.DocumentURI) (bigquery.BigqueryJob, error)
- func (p *Project) TermDocument(ctx context.Context, uri lsp.DocumentURI, position lsp.Position) ([]lsp.MarkedString, error)
- func (p *Project) UpdateFile(uri lsp.DocumentURI, text string, version int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildFieldSchema ¶ added in v0.7.0
func BuildFieldSchema(schema bigquery.Schema) []lsp.FieldSchema
BuildFieldSchema converts a BigQuery schema into the client-facing FieldSchema tree, used to render nested RECORD/REPEATED values and table schemas without exposing the BigQuery SDK types to LSP clients.
Types ¶
type Diagnostics ¶ added in v0.8.0
type Diagnostics struct {
// Src is the text that was analyzed. Positions below are byte offsets
// into it, so convert them with Src rather than the current text, which
// may have been edited since.
Src string
Errors []file.Error
// ErrorFixes holds quick fixes for Errors, keyed by index into Errors.
ErrorFixes map[int][]lint.SuggestedFix
Lint []lint.Diagnostic
}
Diagnostics may be shared with other callers through the cache, so callers must treat its slices and maps as read-only.
type Project ¶
type Project struct {
// contains filtered or unexported fields
}
func NewProject ¶
func NewProjectWithBQClient ¶
func (*Project) Complete ¶
func (p *Project) Complete(ctx context.Context, uri lsp.DocumentURI, position lsp.Position) ([]completion.CompletionItem, error)
func (*Project) DeleteFile ¶
func (p *Project) DeleteFile(uri lsp.DocumentURI)
func (*Project) Diagnose ¶ added in v0.8.0
func (p *Project) Diagnose(ctx context.Context, uri lsp.DocumentURI, cfg lint.Config) (Diagnostics, bool)
Diagnose analyzes uri once and derives both analysis errors and lint diagnostics from that single parse. It returns false when uri is not open. Results are reused until the text, cfg, or the dry-run result for the text changes, because code actions request them on every cursor move. The last successful Dryrun is passed to lint only while the text is unchanged since, as its estimate says nothing about other text.
func (*Project) GetJobDetails ¶ added in v0.7.0
func (p *Project) GetJobDetails(ctx context.Context, projectID, jobID, location string) ([]lsp.MarkedString, func(context.Context) (*bq.RowIterator, error), error)
GetJobDetails polls until the job is done, then returns its details markdown. The returned closure reads the query result rows lazily, reusing the already-fetched (and already-polled-to-completion) job.
func (*Project) GetJobInfo ¶
func (p *Project) GetJobInfo(ctx context.Context, projectID, jobID, location string) ([]lsp.MarkedString, *bq.RowIterator, error)
func (*Project) GetTableDetails ¶ added in v0.7.0
func (p *Project) GetTableDetails(ctx context.Context, projectID, datasetID, tableID string) ([]lsp.MarkedString, []lsp.FieldSchema, func(context.Context) (*bq.RowIterator, error), error)
GetTableDetails fetches table metadata and its details markdown without fetching preview rows. The returned closure fetches the preview rows lazily, reusing the already-fetched metadata instead of calling GetTableMetadata again. GetTableDetails fetches table metadata and its details markdown without fetching preview rows. It also returns the schema as structured FieldSchema data (in addition to the Markdown summary in markedStrings) so callers like the Details webview tab can render a collapsible tree instead of a flat Markdown table. The returned closure fetches the preview rows lazily, reusing the already-fetched metadata instead of calling GetTableMetadata again.
func (*Project) GetTableInfo ¶
func (p *Project) GetTableInfo(ctx context.Context, projectID, datasetID, tableID string) ([]lsp.MarkedString, *bq.RowIterator, error)
func (*Project) InvalidateDiagnostics ¶ added in v0.8.0
func (p *Project) InvalidateDiagnostics(uri lsp.DocumentURI)
InvalidateDiagnostics drops the cached Diagnose result for uri. Table metadata fetch failures are cached with the result, so callers use this when the user asks for a fresh check without editing, e.g. on save.
func (*Project) LookupIdent ¶
func (p *Project) LookupIdent(ctx context.Context, uri lsp.DocumentURI, position lsp.Position) ([]lsp.Location, error)
LookupIdent takes and returns positions in UTF-16 units, the LSP default.
func (*Project) OpenFiles ¶ added in v0.8.0
func (p *Project) OpenFiles() []lsp.DocumentURI
func (*Project) ResolveCompletionItem ¶
func (p *Project) ResolveCompletionItem(ctx context.Context, item lsp.CompletionItem) (lsp.CompletionItem, error)
func (*Project) Run ¶
func (p *Project) Run(ctx context.Context, uri lsp.DocumentURI) (bigquery.BigqueryJob, error)
func (*Project) TermDocument ¶
func (p *Project) TermDocument(ctx context.Context, uri lsp.DocumentURI, position lsp.Position) ([]lsp.MarkedString, error)