Skip to content

Conversation

iisaduan
Copy link
Member

@iisaduan iisaduan commented Oct 2, 2025

I'd like to get this finalized before finalizing the parsing/config request handling. Preceeds #1729

Ports the entire UserPreferences struct and marks the preferences that aren't fully implemented with !!!. I've turned *bool into core.Tristate, which is what CompilerOptions does, and simplified many preferences where it had type undefined | bool in strada and the behavior of undefined was the same as false (aka the default behavior was as-if it was set false). These changes simplify parsing and managing of the lifecycle of preferences structs in snapshots

Also renames the file from ls/types.go->ls/userpreferences.go

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the UserPreferences struct by porting the complete implementation from the TypeScript reference codebase and updating its usage throughout the project.

  • Replaced *bool types with core.Tristate to align with CompilerOptions patterns
  • Simplified preferences where undefined behavior was equivalent to false defaults
  • Updated all references to use the new field names and types

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/ls/userpreferences.go Complete rewrite of UserPreferences struct with comprehensive field definitions and type constants
internal/ls/types.go Removed old UserPreferences definition (moved to userpreferences.go)
internal/ls/completions.go Updated to use Tristate methods and new field names
internal/ls/autoimportfixes.go Converted from pointer-based boolean checks to direct boolean field access
internal/lsp/server.go Updated completion handlers to use core.TSTrue instead of ptrTo(true)
internal/modulespecifiers/*.go Updated field name from ImportModuleSpecifierEndingPreference to ImportModuleSpecifierEnding
internal/checker/nodebuilderimpl.go Updated field name reference for module specifier ending
internal/fourslash/fourslash.go Updated baseline rename logic to handle Tristate instead of pointer types
internal/fourslash/tests/**/*.go Updated test files to use core.TSTrue/TSFalse and removed pointer-based preferences
Comments suppressed due to low confidence (1)

internal/ls/completions.go:1

  • The boolToPtr function always returns nil instead of returning a pointer to the boolean value. This appears to be a bug since the function name suggests it should convert a bool to *bool.
package ls

@iisaduan
Copy link
Member Author

iisaduan commented Oct 2, 2025

I guess its nice that I can now ramble in my PR descriptions, and copilot will write a decent summary 😅

@iisaduan iisaduan added this pull request to the merge queue Oct 2, 2025
Merged via the queue into microsoft:main with commit 688c31d Oct 3, 2025
22 checks passed
@iisaduan iisaduan deleted the update-userPreferences branch October 3, 2025 00:07
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.

3 participants