- Notifications
You must be signed in to change notification settings - Fork817
New auto-import infrastructure#2390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from81 commits
da0e338ea7ec1b5d886963482314654a10450be94c4e1e5ea76a99d7c35779456e22dddf73b49a185c2b8bcce850f47ffb7fb40857877d4efb3318e1516a8013e1c46207c7e201ade0f04bbed1a34e2c186506fc8053a4f8b43d2b958794833f32829392b864bc5e2d4ce391fd0f1fe591d910d2b8b2a98b006b23c7e27b732793f87b670a7f2d0931bcf0691e0ca2b46f3e4096af867a7e64326af6a814a30356bd11dde3c4ef31c4e0fb7f7719d94f6ff3598ee737e9ba700a003bb634f1f4d873b1b5cbb1b88bf709e889632e767d47acc03e965538408c3a2f1826ba0adf7441386c37ee8397564ac8fd03b90c1db129b84b1cce4a9bf390882d723a9d0b13b9744b87128c140fafeb6cc624d49179243d02530d24e83b0ff4a639d04732f401a24f9c976b0992a44e5546296b8882e3bada36cc71072bd0b46d3b84a18aa311618e3e697a304724eab79c810e0be186a0268a3613File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -64,6 +64,7 @@ func runLSP(args []string) int { | ||
| defer stop() | ||
| if err := s.Run(ctx); err != nil { | ||
| fmt.Fprintln(os.Stderr, err) | ||
MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I haven’t looked at#2336 yet, but this could be what’s missing to show a stack trace. | ||
| return 1 | ||
| } | ||
| return 0 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -14430,6 +14430,9 @@ func (c *Checker) getEmitSyntaxForModuleSpecifierExpression(usage *ast.Node) cor | ||
| } | ||
| func (c *Checker) errorNoModuleMemberSymbol(moduleSymbol *ast.Symbol, targetSymbol *ast.Symbol, node *ast.Node, name *ast.Node) { | ||
| if c.compilerOptions.NoCheck.IsTrue() { | ||
MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Auto-imports uses checkers for minimal alias resolution, and these code paths go way down a rabbit hole hitting the file system and using the node builder to generate errors. Added some targeted short circuits. | ||
| return | ||
| } | ||
| moduleName := c.getFullyQualifiedName(moduleSymbol, node) | ||
| declarationName := scanner.DeclarationNameToString(name) | ||
| var suggestion *ast.Symbol | ||
| @@ -14641,6 +14644,7 @@ func (c *Checker) markSymbolOfAliasDeclarationIfTypeOnly(aliasDeclaration *ast.N | ||
| func (c *Checker) resolveExternalModuleName(location *ast.Node, moduleReferenceExpression *ast.Node, ignoreErrors bool) *ast.Symbol { | ||
| errorMessage := diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations | ||
| ignoreErrors = ignoreErrors || c.compilerOptions.NoCheck.IsTrue() | ||
| return c.resolveExternalModuleNameWorker(location, moduleReferenceExpression, core.IfElse(ignoreErrors, nil, errorMessage), ignoreErrors, false /*isForAugmentation*/) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -14,6 +14,9 @@ func NewSetWithSizeHint[T comparable](hint int) *Set[T] { | ||
| } | ||
| func (s *Set[T]) Has(key T) bool { | ||
| if s == nil { | ||
| return false | ||
| } | ||
| _, ok := s.M[key] | ||
| return ok | ||
| } | ||
| @@ -30,14 +33,23 @@ func (s *Set[T]) Delete(key T) { | ||
| } | ||
| func (s *Set[T]) Len() int { | ||
| if s == nil { | ||
| return 0 | ||
| } | ||
| return len(s.M) | ||
| } | ||
| func (s *Set[T]) Keys() map[T]struct{} { | ||
| if s == nil { | ||
| return nil | ||
| } | ||
| return s.M | ||
| } | ||
| func (s *Set[T]) Clear() { | ||
| if s == nil { | ||
| return | ||
| } | ||
| clear(s.M) | ||
| } | ||
| @@ -58,6 +70,37 @@ func (s *Set[T]) Clone() *Set[T] { | ||
| return clone | ||
| } | ||
| func (s *Set[T]) Union(other *Set[T]) { | ||
| if s.Len() == 0 && other.Len() == 0 { | ||
| return | ||
| } | ||
| if s == nil { | ||
| panic("cannot modify nil Set") | ||
| } | ||
| if s.M == nil { | ||
| s.M = maps.Clone(other.M) | ||
| return | ||
| } | ||
| maps.Copy(s.M, other.M) | ||
| } | ||
| func (s *Set[T]) UnionedWith(other *Set[T]) *Set[T] { | ||
| if s == nil && other == nil { | ||
| return nil | ||
| } | ||
| result := s.Clone() | ||
| if other != nil { | ||
| if result == nil { | ||
| result = &Set[T]{} | ||
| } | ||
| if result.M == nil { | ||
| result.M = make(map[T]struct{}, len(other.M)) | ||
| } | ||
| maps.Copy(result.M, other.M) | ||
| } | ||
| return result | ||
| } | ||
| func (s *Set[T]) Equals(other *Set[T]) bool { | ||
| if s == other { | ||
| return true | ||
| @@ -68,6 +111,33 @@ func (s *Set[T]) Equals(other *Set[T]) bool { | ||
| return maps.Equal(s.M, other.M) | ||
| } | ||
| func (s *Set[T]) IsSubsetOf(other *Set[T]) bool { | ||
| if s == nil { | ||
| return true | ||
| } | ||
| if other == nil { | ||
| return false | ||
gabritto marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| } | ||
| for key := range s.M { | ||
| if !other.Has(key) { | ||
| return false | ||
| } | ||
| } | ||
| return true | ||
| } | ||
| func (s *Set[T]) Intersects(other *Set[T]) bool { | ||
| if s == nil || other == nil { | ||
| return false | ||
| } | ||
| for key := range s.M { | ||
| if other.Has(key) { | ||
| return true | ||
| } | ||
| } | ||
| return false | ||
| } | ||
| func NewSetFromItems[T comparable](items ...T) *Set[T] { | ||
| s := &Set[T]{} | ||
| for _, item := range items { | ||
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.