Documentation
¶
Overview ¶
Copyright © 2025 Benny Powers <web@bennypowers.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright © 2025 Benny Powers <web@bennypowers.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Copyright © 2025 Benny Powers <web@bennypowers.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- type Handler
- func (h *Handler) AnalyzeCompletionContext(doc types.Document, position protocol.Position) *types.CompletionAnalysis
- func (h *Handler) Close()
- func (h *Handler) CreateDocument(uri, content string, version int32) types.Document
- func (h *Handler) FindAttributeAtPosition(doc types.Document, position protocol.Position) (*types.AttributeMatch, string)
- func (h *Handler) FindCustomElements(doc types.Document) ([]types.CustomElementMatch, error)
- func (h *Handler) FindElementAtPosition(doc types.Document, position protocol.Position) *types.CustomElementMatch
- func (h *Handler) Language() string
- type TemplateContext
- type TypeScriptDocument
- func (d *TypeScriptDocument) Close()
- func (d *TypeScriptDocument) CompletionPrefix(analysis *types.CompletionAnalysis) string
- func (d *TypeScriptDocument) FindModuleScript() (protocol.Position, bool)
- func (d *TypeScriptDocument) Parse(content string) error
- func (d *TypeScriptDocument) ReleaseCachedHTMLTree(tree *ts.Tree)
- func (d *TypeScriptDocument) SetTree(tree *ts.Tree)
- func (d *TypeScriptDocument) UpdateContent(content string, version int32)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler implements language-specific operations for TypeScript documents
func NewHandler ¶
func NewHandler(queryManager *Q.QueryManager) (*Handler, error)
NewHandler creates a new TypeScript language handler
func (*Handler) AnalyzeCompletionContext ¶
func (h *Handler) AnalyzeCompletionContext(doc types.Document, position protocol.Position) *types.CompletionAnalysis
AnalyzeCompletionContext analyzes completion context for TypeScript documents
func (*Handler) CreateDocument ¶
CreateDocument creates a new TypeScript document
func (*Handler) FindAttributeAtPosition ¶
func (h *Handler) FindAttributeAtPosition(doc types.Document, position protocol.Position) (*types.AttributeMatch, string)
FindAttributeAtPosition finds an attribute at the given position
func (*Handler) FindCustomElements ¶
FindCustomElements finds custom elements in TypeScript template literals
func (*Handler) FindElementAtPosition ¶
func (h *Handler) FindElementAtPosition(doc types.Document, position protocol.Position) *types.CustomElementMatch
FindElementAtPosition finds a custom element at the given position
type TemplateContext ¶
type TemplateContext struct {
Range protocol.Range
Type string // "html", "innerHTML", "outerHTML"
// contains filtered or unexported fields
}
TemplateContext represents an HTML template context in TypeScript
func (*TemplateContext) Content ¶
func (tc *TemplateContext) Content() (string, error)
Content returns the template content
type TypeScriptDocument ¶
type TypeScriptDocument struct {
*base.BaseDocument
// contains filtered or unexported fields
}
TypeScriptDocument represents a TypeScript document with tree-sitter parsing. Always use NewTypeScriptDocument to construct; a zero-value TypeScriptDocument will panic.
Lock ordering: BaseDocument.mu is never held when cacheMu is acquired. Both SetTree and UpdateContent acquire mu (via BaseDocument) then release it before acquiring cacheMu (via invalidateCache). Methods that read cache state under cacheMu may call Version() (acquires mu.RLock) safely because the inverse nesting (mu.Lock -> cacheMu) never occurs.
func NewTypeScriptDocument ¶ added in v0.10.0
func NewTypeScriptDocument(uri, content string, version int32) *TypeScriptDocument
NewTypeScriptDocument creates a new TypeScript document
func (*TypeScriptDocument) Close ¶
func (d *TypeScriptDocument) Close()
Close cleans up document resources including cached HTML trees.
func (*TypeScriptDocument) CompletionPrefix ¶
func (d *TypeScriptDocument) CompletionPrefix(analysis *types.CompletionAnalysis) string
CompletionPrefix extracts the prefix being typed for filtering completions
func (*TypeScriptDocument) FindModuleScript ¶
func (d *TypeScriptDocument) FindModuleScript() (protocol.Position, bool)
FindModuleScript returns EOF position for TypeScript files.
func (*TypeScriptDocument) Parse ¶
func (d *TypeScriptDocument) Parse(content string) error
Parse parses the TypeScript content using tree-sitter
func (*TypeScriptDocument) ReleaseCachedHTMLTree ¶ added in v0.8.0
func (d *TypeScriptDocument) ReleaseCachedHTMLTree(tree *ts.Tree)
ReleaseCachedHTMLTree decrements the reference count for a cached HTML tree
func (*TypeScriptDocument) SetTree ¶
func (d *TypeScriptDocument) SetTree(tree *ts.Tree)
SetTree sets the document's syntax tree and invalidates caches.
func (*TypeScriptDocument) UpdateContent ¶
func (d *TypeScriptDocument) UpdateContent(content string, version int32)
UpdateContent updates the document content and invalidates caches.