Skip to content

Support disabling ATA via VS Code settings for inferred projects#3584

Merged
jakebailey merged 6 commits into
mainfrom
copilot/support-disable-ata-settings
Apr 24, 2026
Merged

Support disabling ATA via VS Code settings for inferred projects#3584
jakebailey merged 6 commits into
mainfrom
copilot/support-disable-ata-settings

Conversation

Copilot AI commented Apr 24, 2026

Copy link
Copy Markdown
Contributor
  • Add DisableAutomaticTypeAcquisition and AutomaticTypeAcquisitionEnabled to UserPreferences with IsATADisabled() helper
  • Gate ATA triggering with s.Config().IsATADisabled() check at call site
  • Handle dynamic preference changes via refreshATAIfNeeded in Configure()
  • Add TODO for js/ts.tsserver.web.typeAcquisition.enabled web variant
  • Unit tests for preference parsing/precedence
  • Integration tests for ATA disabled via both settings and ATA re-enable triggering refresh
  • Only refresh diagnostics on disabled→enabled transition (not both ways)
  • Clarify comments about actual config tag paths used by parser
  • Refactor ATA integration tests to table-driven format

Add DisableAutomaticTypeAcquisition and AutomaticTypeAcquisitionEnabled fields
to UserPreferences to parse the VS Code settings:
- typescript.disableAutomaticTypeAcquisition (deprecated)
- js/ts.tsserver.automaticTypeAcquisition.enabled (unified)

Check user preferences in triggerATAForUpdatedProjects to skip ATA when disabled.

Add unit tests for preference parsing and integration tests for ATA disabling.

Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/94b198f1-5aa1-4398-b088-d801a80e8aaa

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix support for disabling ATA via VS Code settings Support disabling ATA via VS Code settings for inferred projects Apr 24, 2026
Copilot AI requested a review from jakebailey April 24, 2026 16:20
Comment thread internal/project/session.go Outdated
…ller nil check

Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/cbb41f3d-e3a1-49a5-908c-792a96e615f5

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot AI requested a review from jakebailey April 24, 2026 16:38
@jakebailey

Copy link
Copy Markdown
Member

@copilot what happens if the user changes this setting? See other pref update code.

Copilot AI commented Apr 24, 2026

Copy link
Copy Markdown
Contributor Author

@copilot what happens if the user changes this setting? See other pref update code.

Added refreshATAIfNeeded in Configure() following the same pattern as the other preference change handlers. When IsATADisabled() changes between old and new preferences, it calls ScheduleDiagnosticsRefresh() which triggers a snapshot update — this ensures ATA runs for existing projects (those with installedTypingsInfo == nil will get picked up by ShouldTriggerATA). See 333606a.

Comment thread internal/ls/lsutil/userpreferences.go
Copilot AI requested a review from jakebailey April 24, 2026 17:06
@jakebailey jakebailey marked this pull request as ready for review April 24, 2026 17:08
Copilot AI review requested due to automatic review settings April 24, 2026 17:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR adds support for disabling Automatic Type Acquisition (ATA) via VS Code user settings for inferred projects, including dynamic preference changes and test coverage.

Changes:

  • Added ATA-related preferences to lsutil.UserPreferences with an IsATADisabled() helper and precedence rules.
  • Gated ATA triggering in session snapshot updates based on the resolved ATA preference.
  • Added unit/integration tests covering preference parsing, precedence, disabling ATA, and refresh behavior on re-enable.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
internal/project/session.go Gates ATA triggering and refreshes diagnostics when ATA preference changes.
internal/project/ata/ata_test.go Adds integration tests ensuring ATA can be disabled via both unified and deprecated settings, plus refresh on re-enable.
internal/ls/lsutil/userpreferences_test.go Adds unit tests for ATA preference parsing and precedence.
internal/ls/lsutil/userpreferences.go Introduces ATA-related preferences and IsATADisabled() resolution logic.

Comment thread internal/project/session.go
Comment thread internal/project/session.go Outdated
Comment thread internal/ls/lsutil/userpreferences.go Outdated
Comment thread internal/project/ata/ata_test.go Outdated
@jakebailey

Copy link
Copy Markdown
Member

@copilot address review comments. make sure you review your own code next time

…config comments, refactor tests to table-driven

Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/617b0bfb-e582-4a88-b7d8-eab32b3d5525

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>

Copilot AI commented Apr 24, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address review comments. make sure you review your own code next time

Addressed all review comments in 63d152e:

  • refreshATAIfNeeded now only triggers on disabled→enabled transitions (not both ways)
  • Comments on AutomaticTypeAcquisitionEnabled and the TODO updated to reference actual config tag paths as used by the parser
  • ATA disabled tests refactored to table-driven format to reduce duplication

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

andrewbranch
andrewbranch previously approved these changes Apr 24, 2026
@andrewbranch andrewbranch dismissed their stale review April 24, 2026 18:26

Uh oh data race

@jakebailey

Copy link
Copy Markdown
Member

@copilot Investigate this data race from CI:

==================
WARNING: DATA RACE
Write at 0x00c004e2c030 by goroutine 86607:
  runtime.mapassign_faststr()
      /home/cloudtest/.local/share/microsoft-go/go1.26.2-1/src/internal/runtime/maps/runtime_faststr.go:263 +0x0
  github.com/microsoft/typescript-go/internal/collections.(*Set[go.shape.string]).Add()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/collections/set.go:28 +0x1c7
  github.com/microsoft/typescript-go/internal/ls/autoimport.(*RegistryBucket).markNodeModulesDirty()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/ls/autoimport/registry.go:179 +0x118
  github.com/microsoft/typescript-go/internal/ls/autoimport.(*registryBuilder).markBucketsDirty.func4.2()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/ls/autoimport/registry.go:627 +0x17
  github.com/microsoft/typescript-go/internal/project/dirty.(*MapEntry[go.shape.string,go.shape.*uint8]).Change()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/project/dirty/map.go:19 +0x1b1
  github.com/microsoft/typescript-go/internal/ls/autoimport.(*registryBuilder).markBucketsDirty.func4()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/ls/autoimport/registry.go:627 +0xbe4
  github.com/microsoft/typescript-go/internal/ls/autoimport.(*registryBuilder).markBucketsDirty()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/ls/autoimport/registry.go:654 +0x72c
  github.com/microsoft/typescript-go/internal/ls/autoimport.(*Registry).Clone()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/ls/autoimport/registry.go:274 +0x404
  github.com/microsoft/typescript-go/internal/project.(*Snapshot).Clone()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/project/snapshot.go:431 +0x2784
  github.com/microsoft/typescript-go/internal/project.(*Session).updateSnapshot()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/project/session.go:1089 +0x228
  github.com/microsoft/typescript-go/internal/project.(*Session).getSnapshot()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/project/session.go:819 +0x3a6
  github.com/microsoft/typescript-go/internal/project.(*Session).getSnapshotAndDefaultProject()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/project/session.go:877 +0x164
  github.com/microsoft/typescript-go/internal/project.(*Session).WithLanguageServiceAndSnapshot()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/project/session.go:1006 +0x6e
  github.com/microsoft/typescript-go/internal/lsp.init.func1.registerLanguageServiceWithAutoImportsRequestHandler[go.shape.*uint8,go.shape.struct { Items *[]*github.com/microsoft/typescript-go/internal/lsp/lsproto.CompletionItem; List *github.com/microsoft/typescript-go/internal/lsp/lsproto.CompletionList }].33()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/lsp/server.go:833 +0x264
  github.com/microsoft/typescript-go/internal/lsp.(*Server).handleRequestOrNotification()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/lsp/server.go:648 +0x161
  github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/lsp/server.go:527 +0x7c7
  github.com/microsoft/typescript-go/internal/lsp.(*Server).Run.func1()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/lsp/server.go:388 +0x46
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      /home/cloudtest/go/pkg/mod/golang.org/x/sync@v0.20.0/errgroup/errgroup.go:93 +0x86

Previous read at 0x00c004e2c030 by goroutine 104396:
  runtime.mapIterNext()
      /home/cloudtest/.local/share/microsoft-go/go1.26.2-1/src/runtime/map.go:168 +0x0
  github.com/microsoft/typescript-go/internal/ls/autoimport.(*registryBuilder).discoverBucketPackages()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/ls/autoimport/registry.go:1230 +0x149
  github.com/microsoft/typescript-go/internal/ls/autoimport.(*registryBuilder).updateIndexes.func3()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/ls/autoimport/registry.go:759 +0x333

Goroutine 86607 (running) created at:
  golang.org/x/sync/errgroup.(*Group).Go()
      /home/cloudtest/go/pkg/mod/golang.org/x/sync@v0.20.0/errgroup/errgroup.go:78 +0x11c
  github.com/microsoft/typescript-go/internal/lsp.(*Server).Run()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/lsp/server.go:388 +0x1e5
  github.com/microsoft/typescript-go/internal/testutil/lsptestutil.NewLSPClient.func1()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/testutil/lsptestutil/lspclient.go:108 +0xbc
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      /home/cloudtest/go/pkg/mod/golang.org/x/sync@v0.20.0/errgroup/errgroup.go:93 +0x86

Goroutine 104396 (finished) created at:
  sync.(*WaitGroup).Go()
      /home/cloudtest/.local/share/microsoft-go/go1.26.2-1/src/sync/waitgroup.go:238 +0x72
  github.com/microsoft/typescript-go/internal/ls/autoimport.(*Registry).Clone()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/ls/autoimport/registry.go:276 +0x465
  github.com/microsoft/typescript-go/internal/project.(*Snapshot).Clone()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/project/snapshot.go:431 +0x2784
  github.com/microsoft/typescript-go/internal/project.(*Session).warmAutoImportCache()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/project/session.go:1664 +0x995
  github.com/microsoft/typescript-go/internal/project.(*Session).updateSnapshot.func1()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/project/session.go:1124 +0x517
  github.com/microsoft/typescript-go/internal/project/background.(*Queue).Enqueue.func1()
      /usr/local/vss-agent/2.334.0/_work/typescript-go/typescript-go/internal/project/background/queue.go:38 +0x66
==================
--- FAIL: TestAutoImportPackageJsonImportsHashSlashNodenext (0.27s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestAutoCloseTagsWithTriviaAndComplexNames (0.06s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestOrganizeImports_exportLeadingComment_notDuplicated (0.00s)
    --- FAIL: TestOrganizeImports_exportLeadingComment_notDuplicated/commentWithBlankLine (0.03s)
        testing.go:1712: race detected during execution of test
    --- FAIL: TestOrganizeImports_exportLeadingComment_notDuplicated/secondExport (0.02s)
        testing.go:1712: race detected during execution of test
    --- FAIL: TestOrganizeImports_exportLeadingComment_notDuplicated/singleComment (0.02s)
        testing.go:1712: race detected during execution of test
--- FAIL: TestAutoImportErrorMixedExportKinds (0.13s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestAutoImportCrossProjectNodeModules (0.36s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestAutoImportSymlinkedMonorepoSourceUpdate (0.69s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestAutoImportSpecifierExcludeRegexes (0.55s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestAutoImportCompletion2 (0.25s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestArgumentCompletions (0.22s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestAutoImportCompletion3 (0.34s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestAutoImportSymlinkedMonorepoGranularUpdate (0.60s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestAutoImportFileExcludePatterns (0.54s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestFindAllRefsDeclarationInOtherProject (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestFindAllRefsAncestorSiblingProjectsLoading (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestFindAllRefsRootOfReferencedProject (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestFindAllRefsSpecialHandlingOfLocalness (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestAutoImportCompletion1 (0.38s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestDeclarationMapsOpeningOriginalLocationProject (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestCodeLensReferencesShowOnAllFunctions (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestDeclarationMapTestCasesForMaps (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestDeclarationMapsRename (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestCodeLensReferencesShowOnInterfaceMethods (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestCodeLensReferencesShowOnAllClassMethods (0.00s)
    testing.go:1712: race detected during execution of test
--- FAIL: TestCompletionListInUnclosedTypeArguments (12.13s)
    testing.go:1712: race detected during execution of test
FAIL

@jakebailey

Copy link
Copy Markdown
Member

This PR is actually fine, it's #3057 which has data races not caught in its own CI run.

Copilot stopped work on behalf of jakebailey due to an error April 24, 2026 18:38
@jakebailey jakebailey closed this Apr 24, 2026
@jakebailey jakebailey reopened this Apr 24, 2026
@jakebailey jakebailey enabled auto-merge April 24, 2026 20:24
@jakebailey jakebailey added this pull request to the merge queue Apr 24, 2026
Merged via the queue into main with commit e391e41 Apr 24, 2026
42 of 45 checks passed
@jakebailey jakebailey deleted the copilot/support-disable-ata-settings branch April 24, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support disabling ATA via VS Code settings for inferred projects

4 participants