Skip to content

Conversation

@Minibrams
Copy link

We introduce a new configuration property maxLiteralStringLength that fixes #1416 and #1655.
The property can be set either in the serverSettings (e.g. .vscode/settings.json):

{
  "basedpyright.analysis.maxLiteralStringLength": 100
}

or in the pyproject.toml:

[tool.basedpyright]
maxLiteralStringLength = 100

or in the pyrightconfig.json:

{
  "maxLiteralStringLength": 100
}

Know issues

It looks like we can't control the render-length of completion suggestions, which is unfortunate. However, even though completion suggestions are still truncated after 50 characters, the effective value on auto-complete respects the configuration property.

@Minibrams
Copy link
Author

@DetachHead This touches a lot of stuff, so it will probably be a huge pain to merge with future pyright releases...
Don't know how you typically handle this. Let me know if it can be improved.


**basedpyright.analysis.fileEnumerationTimeout** [integer]: Timeout (in seconds) for file enumeration operations. When basedpyright scans your workspace files, it can take a long time in some workspaces. This setting controls when to show a "slow enumeration" warning. Default is 10 seconds.

**basedpyright.analysis.maxLiteralStringLength** [integer]: Maximum number of characters to show for string literals in hovers, completions, etc. Defaults to `50`.
Copy link
Owner

Choose a reason for hiding this comment

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

i think instead of adding a config option we should add an option to the type printer to not truncate the string at all if it's for a completion

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.

Limiting the length of the string literal makes wrong completion

2 participants