Skip to content

Add python.ty.disableLanguageServices config #36

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 17, 2025

Conversation

dhruvmanila
Copy link
Member

@dhruvmanila dhruvmanila commented May 20, 2025

Summary

PR adding support for it in the language server: astral-sh/ruff#18230

This PR adds support for python.ty.disableLanguageServices in the extension to extract the value and pass it as server setting.

Closes: #20

Test Plan

The video starts by the commented out python.ty.disableLanguageServices and you can see that there are inlay hints, hover support, diagnostics, etc.

The hover content for x is Literal[1].

Once it's set to true, the server restarts and inlay hints are gone, hover content is gone but the diagnostics still remain as expected.

Screen.Recording.2025-05-20.at.15.14.41.mov

@BurntSushi
Copy link
Member

@dhruvmanila Can you say more about why this is blocked on microsoft/vscode-python#25041? What are the next steps for getting this merged?

@dhruvmanila
Copy link
Member Author

This PR as is will work only for the ty extension i.e., when python.ty.disableLanguageServices is true, the ty server would not provide any language features. What we want is that the Python extension should also look at this option and disable the Pylance server when the value of that option is false. I've a local branch that adds this understanding in the Python extension but it doesn't work correctly -- changing the value of this option isn't detected by the Python extension so it doesn't start / stop the server if the value is changed.

@MichaReiser
Copy link
Member

This PR as is will work only for the ty extension i.e., when python.ty.disableLanguageServices is true, the ty server would not provide any language features. What we want is that the Python extension should also look at this option and disable the Pylance server when the value of that option is false. I've a local branch that adds this understanding in the Python extension but it doesn't work correctly -- changing the value of this option isn't detected by the Python extension so it doesn't start / stop the server if the value is changed.

But couldn't we ship "our half" of the changes separately from coordianting the setting with pylance (meaning, users would have to toggle the settings manually for now)

@dhruvmanila
Copy link
Member Author

But couldn't we ship "our half" of the changes separately from coordianting the setting with pylance (meaning, users would have to toggle the settings manually for now)

We could, that's what I'm recommending in astral-sh/ruff#18650 (comment) now that I'm looking at it again.

@dhruvmanila dhruvmanila force-pushed the dhruv/disable-language-services branch from dfba961 to e7af1b3 Compare June 16, 2025 09:38
@dhruvmanila dhruvmanila marked this pull request as ready for review June 16, 2025 10:39
@dhruvmanila dhruvmanila requested a review from MichaReiser June 16, 2025 10:39
@MichaReiser MichaReiser added the configuration Related to settings and configuration label Jun 17, 2025
@@ -134,6 +134,8 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
await runServer();
}),
onDidChangeConfiguration(async (e: vscode.ConfigurationChangeEvent) => {
// TODO(dhruvmanila): Notify the server with `DidChangeConfigurationNotification` and let
Copy link
Member

Choose a reason for hiding this comment

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

I assume you plan to work on this as part of the client settings issue where you also want to explore a pull configuration model.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes!

dhruvmanila added a commit to astral-sh/ruff that referenced this pull request Jun 17, 2025
## Summary

PR adding support for it in the VS Code extension:
astral-sh/ty-vscode#36

This PR adds support for `python.ty.disableLanguageServices` to the ty
language server by accepting this as server setting.

This has the same issue as astral-sh/ty#282 in
that it only works when configured globally. Fixing that requires
support for multiple workspaces in the server itself.

I also went ahead and did a similar refactor as the Ruff server to use
"Options" and "Settings" to keep the code consistent although the
combine functionality doesn't exists yet because workspace settings
isn't supported in the ty server.

## Test Plan

Refer to astral-sh/ty-vscode#36 for the test
demo.
@dhruvmanila dhruvmanila merged commit 1cc299a into main Jun 17, 2025
1 check passed
@dhruvmanila dhruvmanila deleted the dhruv/disable-language-services branch June 17, 2025 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Related to settings and configuration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a way (config option) to disable language services
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy