Skip to content

[ty] Implement workspace/didChangeConfiguration#24712

Open
pierrem964 wants to merge 11 commits intoastral-sh:mainfrom
pierrem964:pgm/workspace-did-change-configuration
Open

[ty] Implement workspace/didChangeConfiguration#24712
pierrem964 wants to merge 11 commits intoastral-sh:mainfrom
pierrem964:pgm/workspace-did-change-configuration

Conversation

@pierrem964
Copy link
Copy Markdown

@pierrem964 pierrem964 commented Apr 19, 2026

Summary

Implements astral-sh/ty#953

Adds a notification handler for workspace/didConfigurationChange. Re initializes workspaces when this is received with the newly pulled settings.

Workspaces are just reinitialized with a new settings passed from the client.

Copied code from #20545, so credit to @Guillaume-Fgt for that.

Test Plan

I've added a unit test in configuration making sure this runs successfully. I am unsure if this is sufficient so please let me know how I can improve the testing implemented in this PR.

Manually tested on vscode via the extension and neovim

@astral-sh-bot astral-sh-bot Bot added the ty Multi-file analysis & type inference label Apr 19, 2026
Comment thread crates/ty_server/src/session.rs Outdated
@carljm carljm removed their request for review April 20, 2026 20:57
},
);

Ok(())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should call publish_diagnostics_if_needed here for clients using the push diagnostics model.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Do we need to updates tests to cover this?

fn run(
session: &mut Session,
client: &Client,
_params: types::DidChangeConfigurationParams,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The params do contain the changed setting. Do you know if it includes all settings or do clients indeed only send the changed settings?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

On neovim, the invocation of this notification is manual, so you need to pass the settings as an argument through client:notify.

Had a go trying to see what vscode send with the didChangeConfiguration event, it seems like nothing is sent at all.

It seems this varies from client to client. Let me know if I've misunderstood this comment :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Testing it with VS Code would be good. Specifically also to test whether it sends the notification is only sent when changing ty specific settings or is sent when changing arbitrary VS Code settings.

It would be so nice if it included the whole configuration. It feels silly that we have to request the configuration again :( I'd rather avoid that

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I removed all the selected items from:

https://github.com/astral-sh/ty-vscode/blob/da5152f543a9f659bceae71748ba535a5b2a536b/src/common/settings.ts#L122-L130

Running ty with this PRs compiled executable I get the following behavior:

Changing a ty setting (diagnostic mode), I get the log:

[Trace - 6:23:48 PM] Sending notification 'workspace/didChangeConfiguration'.
Params: {
    "settings": null
}

Changing a non-ty, vscode setting (Auto Save), I also get the log:

[Trace - 6:24:46 PM] Sending notification 'workspace/didChangeConfiguration'.
Params: {
    "settings": null
}

Unfortunately I don't think it includes the config =(, at least with vscode it seems necessary to repull everything.

Comment thread crates/ty_project/src/lib.rs Outdated
@pierrem964 pierrem964 force-pushed the pgm/workspace-did-change-configuration branch from 0d5366f to 7ed12ec Compare April 28, 2026 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants