Skip to content
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

Pyright not using settings file anymore #373

Closed
thecircleisround opened this issue Nov 14, 2024 · 11 comments
Closed

Pyright not using settings file anymore #373

thecircleisround opened this issue Nov 14, 2024 · 11 comments
Labels
upstream Upstream issue

Comments

@thecircleisround
Copy link

Since most recent update, pyright is no longing sourcing my user configuration.

@thecircleisround
Copy link
Author

From Console

Unable to open /Users/[USERNAME]/Library/Application Support/Sublime Text 3/Packages/LSP-pyright/LSP-pyright.sublime-settings

@jfcherng
Copy link
Collaborator

jfcherng commented Nov 14, 2024

From Console

Unable to open /Users/[USERNAME]/Library/Application Support/Sublime Text 3/Packages/LSP-pyright/LSP-pyright.sublime-settings

That's a unrelated ST bug actually. And the "unable to open" settings file is actually loaded. Reported sublimehq/sublime_text#6535


What's your real issue there?

@thecircleisround
Copy link
Author

thecircleisround commented Nov 14, 2024

None of the settings for pyright are being adhered to. I think you were the person I worked with a year ago when I had issues with disabling some of the typing features. All of those settings are now being ignored

@jfcherng
Copy link
Collaborator

Can you provide a reproducer? If you mean ANY, then provide ANY.

@thecircleisround
Copy link
Author

// Settings in here override those in "LSP-pyright/LSP-pyright.sublime-settings"

{
	"command": ["${node_bin}", "${server_path}", "--stdio"],
	"schemes": [
		"file", // regular files
		"buffer", // in-memory buffers
		"res", // files in .sublime-package archives
	],
	// @see https://github.com/microsoft/pyright/blob/main/docs/settings.md
	// @see https://github.com/microsoft/pyright/blob/main/packages/vscode-pyright/package.json
	"settings": {
		// Use a predefined setup from this plugin, valid values are:
		// - "": An empty string does nothing.
		// - "sublime_text": Suitable for people who are developing ST Python plugins.
		//                   The Python version which the developed plugin runs on will be used.
		//                   `sys.path` from plugin_host will be added into "python.analysis.extraPaths"
		//                   so ST package dependecies can be resolved by the LSP server.
		// - "sublime_text_33": Similar to "sublime_text" but Python 3.3 forced.
		// - "sublime_text_38": Similar to "sublime_text" but Python 3.8 forced.
		"pyright.dev_environment": "",
		// Offer auto-import completions.
		"python.analysis.autoImportCompletions": true,
		// Automatically add common search paths like 'src'?
		"python.analysis.autoSearchPaths": true,
		// Additional import search resolution paths
		"python.analysis.extraPaths": [],
		// Path to directory containing custom type stub files.
		"python.analysis.stubPath": "./typings",
		// "openFilesOnly" or "workspace"
		"python.analysis.diagnosticMode": "openFilesOnly",
		// Allows a user to override the severity levels for individual diagnostics.
		// @see https://github.com/microsoft/pyright/blob/main/docs/configuration.md#type-check-diagnostics-settings
		"python.analysis.diagnosticSeverityOverrides": {
			"reportDuplicateImport": "warning",
			"reportImplicitStringConcatenation": "warning",
			"reportMissingParameterType": "none",
			"reportUnboundVariable": "warning",
			"reportUninitializedInstanceVariable": "none",
			"reportUnusedClass": "information",
			"reportUnusedFunction": "information",
			"reportUnusedImport": "information",
			"reportUnusedVariable": "information",
			"reportGeneralTypeIssues": "none",
			"reportAbstractUsage": "none",
			"reportArgumentType": "none",
			"reportAssertTypeFailure": "none",
			"reportAssignmentType": "none",
			"reportAttributeAccessIssue": "none",
			"reportCallIssue": "none",
			"reportInconsistentOverload": "none",
			"reportIndexIssue": "none",
			"reportInvalidTypeArguments": "none",
			"reportInvalidTypeForm": "none",
			"reportNoOverloadImplementation": "none",
			"reportOperatorIssue": "none",
			"reportPossiblyUnboundVariable": "none",
			"reportRedeclaration": "none",
			"reportReturnType": "none",
			"reportUnusedExcept": "none",
			"reportOptionalMemberAccess": "none", 
			"reportPropertyTypeMismatch": "none", 
		},
		// Specifies the level of logging for the Output panel
		"python.analysis.logLevel": "Information",
		// Defines the default rule set for type checking.
		"python.analysis.typeCheckingMode": "off",
		// Paths to look for typeshed modules.
		// Hmm... doesn't seem to work on my side. May track https://github.com/microsoft/pylance-release/issues/29
		"python.analysis.typeshedPaths": [],
		// Use library implementations to extract type information when type stub is not present.
		"python.analysis.useLibraryCodeForTypes": true,
		// Disables type completion, definitions, and references.
		"pyright.disableLanguageServices": false,
		// Disables the "Organize Imports" command.
		"pyright.disableOrganizeImports": false,
		"python.analysis.typeCheckingMode": "none",
		// Path to Python. Leave empty to attempt automatic resolution.
		"python.pythonPath": "",
		// Path to folder with a list of Virtual Environments.
		"python.venvPath": "",
	},
	// ST4
	"selector": "source.python",
	// ST3
	"languages": [
		{
			"scopes": ["source.python - source.python.lsp"],
			"syntaxes": ["Packages/Python/Python.sublime-syntax"],
		},
	],
}

Screenshot 2024-11-14 at 1 27 47 PM
Screenshot 2024-11-14 at 1 28 32 PM

@jfcherng
Copy link
Collaborator

jfcherng commented Nov 14, 2024

From what I can tell, this seems to happen when I have a pyproject.toml file. If I remove the pyproject.toml file, settings (such as reportAttributeAccessIssue) are respected. Can you confirm this?

@thecircleisround
Copy link
Author

I don't have a pyproject.toml file anywhere. Everything was working until the update

@jfcherng
Copy link
Collaborator

So your last working release is https://github.com/sublimelsp/LSP-pyright/releases/tag/1.4.32 ?

@jfcherng
Copy link
Collaborator

On my side, as long as I have a [tool.pyright] section in pyproject.toml, LSP-pyright's python.analysis.diagnosticSeverityOverrides (may be more) seems to be ignored.

@jfcherng
Copy link
Collaborator

jfcherng commented Nov 14, 2024

Same for pyrightconfig.json. If I have pyrightconfig.json, whose content even is just {}, LSP-pyright settings are not respected.

@jfcherng
Copy link
Collaborator

jfcherng commented Nov 14, 2024

Basing on microsoft/pyright#9304 (comment), I consider this as upstream's design.

Details: https://microsoft.github.io/pyright/#/configuration?id=overriding-settings-in-vs-code

Overriding settings (in VS Code)

If a pyproject.toml (with a pyright section) or a pyrightconfig.json exists, any pyright settings in a VS Code settings.json will be ignored. Pyrightconfig.json is prescribing the environment to be used for a particular project. Changing the environment configuration options per user is not supported.

If a pyproject.toml (with a pyright section) or a pyrightconfig.json does not exist, then the VS Code settings.json settings apply.

@jfcherng jfcherng added the upstream Upstream issue label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream Upstream issue
Projects
None yet
Development

No branches or pull requests

2 participants