@@ -344,11 +344,11 @@ func (s *Snapshot) Templates() map[protocol.DocumentURI]file.Handle {
344
344
defer s .mu .Unlock ()
345
345
346
346
tmpls := map [protocol.DocumentURI ]file.Handle {}
347
- s . files . foreach ( func ( k protocol. DocumentURI , fh file. Handle ) {
347
+ for k , fh := range s . files . all ( ) {
348
348
if s .FileKind (fh ) == file .Tmpl {
349
349
tmpls [k ] = fh
350
350
}
351
- })
351
+ }
352
352
return tmpls
353
353
}
354
354
@@ -864,13 +864,13 @@ func (s *Snapshot) addKnownSubdirs(patterns map[protocol.RelativePattern]unit, w
864
864
s .mu .Lock ()
865
865
defer s .mu .Unlock ()
866
866
867
- s .files .getDirs ().Range ( func ( dir string ) {
867
+ for dir := range s .files .getDirs ().All ( ) {
868
868
for _ , wsDir := range wsDirs {
869
869
if pathutil .InDir (wsDir , dir ) {
870
870
patterns [protocol.RelativePattern {Pattern : filepath .ToSlash (dir )}] = unit {}
871
871
}
872
872
}
873
- })
873
+ }
874
874
}
875
875
876
876
// watchSubdirs reports whether gopls should request separate file watchers for
@@ -912,11 +912,11 @@ func (s *Snapshot) filesInDir(uri protocol.DocumentURI) []protocol.DocumentURI {
912
912
return nil
913
913
}
914
914
var files []protocol.DocumentURI
915
- s . files . foreach ( func ( uri protocol. DocumentURI , _ file. Handle ) {
915
+ for uri := range s . files . all ( ) {
916
916
if pathutil .InDir (dir , uri .Path ()) {
917
917
files = append (files , uri )
918
918
}
919
- })
919
+ }
920
920
return files
921
921
}
922
922
@@ -1029,13 +1029,11 @@ func (s *Snapshot) clearShouldLoad(scopes ...loadScope) {
1029
1029
case packageLoadScope :
1030
1030
scopePath := PackagePath (scope )
1031
1031
var toDelete []PackageID
1032
- s .shouldLoad .Range (func (id PackageID , pkgPaths []PackagePath ) {
1033
- for _ , pkgPath := range pkgPaths {
1034
- if pkgPath == scopePath {
1035
- toDelete = append (toDelete , id )
1036
- }
1032
+ for id , pkgPaths := range s .shouldLoad .All () {
1033
+ if slices .Contains (pkgPaths , scopePath ) {
1034
+ toDelete = append (toDelete , id )
1037
1035
}
1038
- })
1036
+ }
1039
1037
for _ , id := range toDelete {
1040
1038
s .shouldLoad .Delete (id )
1041
1039
}
@@ -1183,7 +1181,7 @@ func (s *Snapshot) reloadWorkspace(ctx context.Context) {
1183
1181
var scopes []loadScope
1184
1182
var seen map [PackagePath ]bool
1185
1183
s .mu .Lock ()
1186
- s . shouldLoad . Range ( func ( _ PackageID , pkgPaths [] PackagePath ) {
1184
+ for _ , pkgPaths := range s . shouldLoad . All ( ) {
1187
1185
for _ , pkgPath := range pkgPaths {
1188
1186
if seen == nil {
1189
1187
seen = make (map [PackagePath ]bool )
@@ -1194,7 +1192,7 @@ func (s *Snapshot) reloadWorkspace(ctx context.Context) {
1194
1192
seen [pkgPath ] = true
1195
1193
scopes = append (scopes , packageLoadScope (pkgPath ))
1196
1194
}
1197
- })
1195
+ }
1198
1196
s .mu .Unlock ()
1199
1197
1200
1198
if len (scopes ) == 0 {
@@ -1886,13 +1884,13 @@ func deleteMostRelevantModFile(m *persistent.Map[protocol.DocumentURI, *memoize.
1886
1884
var mostRelevant protocol.DocumentURI
1887
1885
changedFile := changed .Path ()
1888
1886
1889
- m . Range ( func ( modURI protocol. DocumentURI , _ * memoize. Promise ) {
1887
+ for modURI := range m . All ( ) {
1890
1888
if len (modURI ) > len (mostRelevant ) {
1891
1889
if pathutil .InDir (modURI .DirPath (), changedFile ) {
1892
1890
mostRelevant = modURI
1893
1891
}
1894
1892
}
1895
- })
1893
+ }
1896
1894
if mostRelevant != "" {
1897
1895
m .Delete (mostRelevant )
1898
1896
}
0 commit comments