Skip to content
Draft
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
68c5302
Initial plan
Copilot Jul 11, 2025
e4b5e3c
Add getJSSyntacticDiagnosticsForFile implementation and additionalSyn…
Copilot Jul 11, 2025
194f161
Fix AST node conversion issues and add comprehensive test case
Copilot Jul 11, 2025
466a9f8
Add NodeFlagsReparsed check to bail out early for synthesized type an…
Copilot Jul 11, 2025
3e0d26f
Update baselines after implementing NodeFlagsReparsed check
Copilot Jul 11, 2025
bd6a76d
Move diagnostic calculation to ast package with thread-safe lazy eval…
Copilot Jul 11, 2025
1e6c41e
Refactor JS diagnostic functions: move field order and extract to sep…
Copilot Jul 11, 2025
84ece9d
Address review feedback: format code, fix diagnostics initialization,…
Copilot Jul 11, 2025
617d7ac
Add NodeFlagsReparsed checks to fix false positives on JSDoc type ann…
Copilot Jul 11, 2025
2f7b583
Move JS diagnostics from ast to compiler package and use SyncMap for …
Copilot Jul 11, 2025
d55f804
Fix false positives on JSDoc type arguments in JavaScript files
Copilot Jul 11, 2025
732f699
Refactor JS diagnostics: move to separate file and use visitor pattern
Copilot Jul 11, 2025
eaeddaf
Refactor JS diagnostics to use binder and scanner functions for bette…
Copilot Jul 11, 2025
0eb0b7f
Merge branch 'main' into copilot/fix-1386
jakebailey Jul 11, 2025
0305435
Fix JS diagnostic positioning and detection issues
Copilot Jul 11, 2025
457a6d3
Fix JS diagnostic positioning for type parameters to match TypeScript…
Copilot Jul 11, 2025
88f567f
Remove isTypeScriptOnlyModifier function and fix modifier checking logic
Copilot Jul 11, 2025
47234a3
Add missing question mark modifier check for method and property decl…
Copilot Jul 11, 2025
5d296fa
Remove duplicate JS diagnostic cases and fix token text detection
Copilot Jul 11, 2025
bd46d8a
Manual tweak
jakebailey Jul 11, 2025
241e1c7
Merge branch 'main' into copilot/fix-1386
jakebailey Jul 11, 2025
8389be3
Extract JS diagnostics calculation into helper function
Copilot Jul 11, 2025
94d8aed
Fix JS diagnostics caching to avoid unnecessary AST walks
Copilot Jul 11, 2025
4894614
Move GetErrorRangeForNode to scanner
jakebailey Jul 11, 2025
563ca59
Remove old todo
jakebailey Jul 11, 2025
a460d7b
Merge branch 'main' into copilot/fix-1386
jakebailey Jul 11, 2025
1719219
Move to parser
jakebailey Jul 11, 2025
4873b39
Fix binding issue
jakebailey Jul 11, 2025
ec7ddc5
Remove cache
jakebailey Jul 11, 2025
e67cd95
No need for empty slice anymore
jakebailey Jul 11, 2025
74416e1
Simplify JS diagnostics code per review feedback - reduce redundancy …
Copilot Jul 21, 2025
b48403d
Fix type argument panic and improve type node detection - partial fix…
Copilot Jul 21, 2025
a76f6f6
Fix JS syntactic diagnostics for null/undefined literals and type arg…
Copilot Jul 21, 2025
60db541
Fix false positive error on ternary operators in JavaScript files
Copilot Jul 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 49 additions & 22 deletions internal/ast/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -10046,28 +10046,28 @@ type SourceFile struct {
EndOfFileToken *TokenNode // TokenNode[*EndOfFileToken]

// Fields set by parser
diagnostics []*Diagnostic
jsdocDiagnostics []*Diagnostic
LanguageVariant core.LanguageVariant
ScriptKind core.ScriptKind
IsDeclarationFile bool
UsesUriStyleNodeCoreModules core.Tristate
Identifiers map[string]string
IdentifierCount int
imports []*LiteralLikeNode // []LiteralLikeNode
ModuleAugmentations []*ModuleName // []ModuleName
AmbientModuleNames []string
CommentDirectives []CommentDirective
jsdocCache map[*Node][]*Node
Pragmas []Pragma
ReferencedFiles []*FileReference
TypeReferenceDirectives []*FileReference
LibReferenceDirectives []*FileReference
CheckJsDirective *CheckJsDirective
NodeCount int
TextCount int
CommonJSModuleIndicator *Node
ExternalModuleIndicator *Node
diagnostics []*Diagnostic
jsdocDiagnostics []*Diagnostic
LanguageVariant core.LanguageVariant
ScriptKind core.ScriptKind
IsDeclarationFile bool
UsesUriStyleNodeCoreModules core.Tristate
Identifiers map[string]string
IdentifierCount int
imports []*LiteralLikeNode // []LiteralLikeNode
ModuleAugmentations []*ModuleName // []ModuleName
AmbientModuleNames []string
CommentDirectives []CommentDirective
jsdocCache map[*Node][]*Node
Pragmas []Pragma
ReferencedFiles []*FileReference
TypeReferenceDirectives []*FileReference
LibReferenceDirectives []*FileReference
CheckJsDirective *CheckJsDirective
NodeCount int
TextCount int
CommonJSModuleIndicator *Node
ExternalModuleIndicator *Node

// Fields set by binder

Expand All @@ -10085,6 +10085,11 @@ type SourceFile struct {
lineMapMu sync.RWMutex
lineMap []core.TextPos

// Fields set by AdditionalSyntacticDiagnostics

additionalSyntacticDiagnosticsMu sync.RWMutex
additionalSyntacticDiagnostics []*Diagnostic

// Fields set by language service

tokenCacheMu sync.Mutex
Expand Down Expand Up @@ -10146,6 +10151,26 @@ func (node *SourceFile) SetJSDocDiagnostics(diags []*Diagnostic) {
node.jsdocDiagnostics = diags
}

func (node *SourceFile) AdditionalSyntacticDiagnostics() []*Diagnostic {
node.additionalSyntacticDiagnosticsMu.RLock()
diagnostics := node.additionalSyntacticDiagnostics
node.additionalSyntacticDiagnosticsMu.RUnlock()
if diagnostics == nil {
node.additionalSyntacticDiagnosticsMu.Lock()
defer node.additionalSyntacticDiagnosticsMu.Unlock()
diagnostics = node.additionalSyntacticDiagnostics
if diagnostics == nil {
diagnostics = getJSSyntacticDiagnosticsForFile(node)
node.additionalSyntacticDiagnostics = diagnostics
}
}
return diagnostics
}

func (node *SourceFile) SetAdditionalSyntacticDiagnostics(diags []*Diagnostic) {
node.additionalSyntacticDiagnostics = diags
}

func (node *SourceFile) JSDocCache() map[*Node][]*Node {
return node.jsdocCache
}
Expand Down Expand Up @@ -10466,3 +10491,5 @@ type PragmaSpecification struct {
func (spec *PragmaSpecification) IsTripleSlash() bool {
return (spec.Kind & PragmaKindTripleSlashXML) > 0
}


Loading