Skip to content

Commit 7615f8a

Browse files
committed
lint
1 parent 0f8d4b5 commit 7615f8a

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

internal/fourslash/fourslash.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3827,11 +3827,11 @@ func (f *FourslashTest) renameFileOrDirectory(t *testing.T, oldPath string, newP
38273827
if d.IsDir() {
38283828
return nil
38293829
}
3830-
content, ok := f.vfs.ReadFile(path)
3831-
if !ok {
3830+
fileContent, exists := f.vfs.ReadFile(path)
3831+
if !exists {
38323832
return fmt.Errorf("file %s disappeared during rename walk", path)
38333833
}
3834-
renamedContents[path] = content
3834+
renamedContents[path] = fileContent
38353835
return nil
38363836
})
38373837
if walkErr != nil {

internal/ls/filerename.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package ls
22

33
import (
44
"context"
5+
"slices"
56
"strings"
67

78
"github.com/microsoft/typescript-go/internal/ast"
@@ -201,7 +202,7 @@ func (l *LanguageService) updateImportsForFileRename(program *compiler.Program,
201202
}
202203

203204
for _, importStringLiteral := range sourceFile.Imports() {
204-
updated := l.getUpdatedImportSpecifier(program, checker, sourceFile, (*ast.StringLiteralLike)(importStringLiteral), oldToNew, newToOld, newImportFromPath, oldImportFromPath, importingSourceFileMoved, moduleSpecifierPreferences)
205+
updated := l.getUpdatedImportSpecifier(program, checker, sourceFile, importStringLiteral, oldToNew, newToOld, newImportFromPath, oldImportFromPath, importingSourceFileMoved, moduleSpecifierPreferences)
205206
if updated != "" && updated != importStringLiteral.Text() {
206207
changeTracker.ReplaceRangeWithText(sourceFile, l.converters.ToLSPRange(sourceFile, createStringTextRange(sourceFile, importStringLiteral)), updated)
207208
}
@@ -448,10 +449,5 @@ func isAmbientModuleSymbol(symbol *ast.Symbol) bool {
448449
if symbol == nil {
449450
return false
450451
}
451-
for _, decl := range symbol.Declarations {
452-
if ast.IsModuleWithStringLiteralName(decl) {
453-
return true
454-
}
455-
}
456-
return false
452+
return slices.ContainsFunc(symbol.Declarations, ast.IsModuleWithStringLiteralName)
457453
}

0 commit comments

Comments
 (0)