Skip to content

Commit b4dc48c

Browse files
committed
Merge branch 'main' into jabaile/symbol-tweaks
2 parents 896feac + 6fc5cb8 commit b4dc48c

File tree

9,603 files changed

+349720
-208803
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

9,603 files changed

+349720
-208803
lines changed

.github/actions/setup-go/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ runs:
1414
steps:
1515
- name: Install Go
1616
id: install-go
17-
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
17+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
1818
with:
1919
go-version: ${{ inputs.go-version }}
2020
cache: false

_build/azure-pipelines.compliance.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ resources:
1111
ref: refs/tags/release
1212

1313
extends:
14-
template: v1/1ES.Unofficial.PipelineTemplate.yml@1esPipelines
14+
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
1515
parameters:
1616
pool:
1717
name: TypeScript-AzurePipelines-EO
@@ -24,7 +24,6 @@ extends:
2424
fetchDepth: 1
2525
fetchTags: false
2626
retryCount: 3
27-
enableProductionSDL: true
2827
sourceAnalysisPool:
2928
name: TypeScript-AzurePipelines-EO
3029
image: 1ESPT-Windows2022

cmd/tsgo/lsp.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
package main
22

33
import (
4-
"errors"
54
"flag"
65
"fmt"
7-
"io"
86
"os"
97

108
"github.com/microsoft/typescript-go/internal/bundled"
@@ -49,7 +47,7 @@ func runLSP(args []string) int {
4947
DefaultLibraryPath: defaultLibraryPath,
5048
})
5149

52-
if err := s.Run(); err != nil && !errors.Is(err, io.EOF) {
50+
if err := s.Run(); err != nil {
5351
return 1
5452
}
5553
return 0

internal/ast/ast.go

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,10 @@ func (n *Node) AsNotEmittedStatement() *NotEmittedStatement {
14481448
return n.data.(*NotEmittedStatement)
14491449
}
14501450

1451+
func (n *Node) AsNotEmittedTypeElement() *NotEmittedTypeElement {
1452+
return n.data.(*NotEmittedTypeElement)
1453+
}
1454+
14511455
func (n *Node) AsJSDoc() *JSDoc {
14521456
return n.data.(*JSDoc)
14531457
}
@@ -4035,6 +4039,28 @@ func IsNotEmittedStatement(node *Node) bool {
40354039
return node.Kind == KindNotEmittedStatement
40364040
}
40374041

4042+
// NotEmittedTypeElement
4043+
4044+
// Represents a type element that is elided as part of a transformation to emit comments on a
4045+
// not-emitted node.
4046+
type NotEmittedTypeElement struct {
4047+
NodeBase
4048+
TypeElementBase
4049+
}
4050+
4051+
func (f *NodeFactory) NewNotEmittedTypeElement() *Node {
4052+
data := &NotEmittedTypeElement{}
4053+
return newNode(KindNotEmittedTypeElement, data, f.hooks)
4054+
}
4055+
4056+
func (node *NotEmittedTypeElement) Clone(f NodeFactoryCoercible) *Node {
4057+
return cloneNode(f.AsNodeFactory().NewNotEmittedTypeElement(), node.AsNode(), f.AsNodeFactory().hooks)
4058+
}
4059+
4060+
func IsNotEmittedTypeElement(node *Node) bool {
4061+
return node.Kind == KindNotEmittedTypeElement
4062+
}
4063+
40384064
// ImportEqualsDeclaration
40394065

40404066
type ImportEqualsDeclaration struct {
@@ -9925,7 +9951,7 @@ type SourceFile struct {
99259951
UsesUriStyleNodeCoreModules core.Tristate
99269952
Identifiers map[string]string
99279953
IdentifierCount int
9928-
Imports []*LiteralLikeNode // []LiteralLikeNode
9954+
imports []*LiteralLikeNode // []LiteralLikeNode
99299955
ModuleAugmentations []*ModuleName // []ModuleName
99309956
AmbientModuleNames []string
99319957
CommentDirectives []CommentDirective
@@ -9996,6 +10022,14 @@ func (node *SourceFile) Path() tspath.Path {
999610022
return node.path
999710023
}
999810024

10025+
func (node *SourceFile) OriginalFileName() string {
10026+
return node.FileName() // !!! redirect source files
10027+
}
10028+
10029+
func (node *SourceFile) Imports() []*LiteralLikeNode {
10030+
return node.imports
10031+
}
10032+
999910033
func (node *SourceFile) Diagnostics() []*Diagnostic {
1000010034
return node.diagnostics
1000110035
}
@@ -10036,6 +10070,10 @@ func (node *SourceFile) VisitEachChild(v *NodeVisitor) *Node {
1003610070
return v.Factory.UpdateSourceFile(node, v.visitTopLevelStatements(node.Statements))
1003710071
}
1003810072

10073+
func (node *SourceFile) IsJS() bool {
10074+
return IsSourceFileJS(node)
10075+
}
10076+
1003910077
func (node *SourceFile) copyFrom(other *SourceFile) {
1004010078
// Do not copy fields set by NewSourceFile (Text, FileName, Path, or Statements)
1004110079
node.LanguageVersion = other.LanguageVersion
@@ -10045,7 +10083,7 @@ func (node *SourceFile) copyFrom(other *SourceFile) {
1004510083
node.HasNoDefaultLib = other.HasNoDefaultLib
1004610084
node.UsesUriStyleNodeCoreModules = other.UsesUriStyleNodeCoreModules
1004710085
node.Identifiers = other.Identifiers
10048-
node.Imports = other.Imports
10086+
node.imports = other.imports
1004910087
node.ModuleAugmentations = other.ModuleAugmentations
1005010088
node.AmbientModuleNames = other.AmbientModuleNames
1005110089
node.CommentDirectives = other.CommentDirectives

internal/ast/diagnostic.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ type Diagnostic struct {
1919
message string
2020
messageChain []*Diagnostic
2121
relatedInformation []*Diagnostic
22+
reportsUnnecessary bool
23+
reportsDeprecated bool
2224
}
2325

2426
func (d *Diagnostic) File() *SourceFile { return d.file }
@@ -31,6 +33,8 @@ func (d *Diagnostic) Category() diagnostics.Category { return d.category }
3133
func (d *Diagnostic) Message() string { return d.message }
3234
func (d *Diagnostic) MessageChain() []*Diagnostic { return d.messageChain }
3335
func (d *Diagnostic) RelatedInformation() []*Diagnostic { return d.relatedInformation }
36+
func (d *Diagnostic) ReportsUnnecessary() bool { return d.reportsUnnecessary }
37+
func (d *Diagnostic) ReportsDeprecated() bool { return d.reportsDeprecated }
3438

3539
func (d *Diagnostic) SetFile(file *SourceFile) { d.file = file }
3640
func (d *Diagnostic) SetLocation(loc core.TextRange) { d.loc = loc }
@@ -67,11 +71,13 @@ func (d *Diagnostic) Clone() *Diagnostic {
6771

6872
func NewDiagnostic(file *SourceFile, loc core.TextRange, message *diagnostics.Message, args ...any) *Diagnostic {
6973
return &Diagnostic{
70-
file: file,
71-
loc: loc,
72-
code: message.Code(),
73-
category: message.Category(),
74-
message: message.Format(args...),
74+
file: file,
75+
loc: loc,
76+
code: message.Code(),
77+
category: message.Category(),
78+
message: message.Format(args...),
79+
reportsUnnecessary: message.ReportsUnnecessary(),
80+
reportsDeprecated: message.ReportsDeprecated(),
7581
}
7682
}
7783

internal/ast/kind.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ const (
387387
KindPartiallyEmittedExpression
388388
KindCommaListExpression
389389
KindSyntheticReferenceExpression
390+
KindNotEmittedTypeElement
390391
// Enum value count
391392
KindCount
392393
// Markers

0 commit comments

Comments
 (0)