Transforms type hints

The Palantir extension for Visual Studio Code includes a linter to ensure the correct usage of transform parameter types in your Python code. This linter suggests code actions to add or update transform parameter type hints, ensuring that the Python language server provides accurate code completions.

Usage

The linter displays warnings for missing or incorrect type hints:

The information box for the linting error.

You can fix the warnings by selecting Quick Fix and choosing one of the suggested code actions:

The code actions to resolve the linting error.

The linter automatically inserts the required import statements and adds the correct type hints to the function parameters.

Disable type hints

You can disable type hint suggestions globally in the settings, or use inline comments to instruct the linter to skip specific lines or files.

Disable type hints in settings

To disable type hints, go to Settings > Extensions > Palantir > Transforms Type Hints, and uncheck the box. This is equivalent to adding "palantir.transforms.typehints.enabled": false to your settings.json file.

Disabling transform type hints in the settings.

Disable type hints with inline comments

You can disable type hint suggestions inline by using special comments. The linter supports the following comments:

CommentBehavior
# palantir: ignoreIgnores all type hints if placed at the beginning of the file; ignores type hints for the specific line if placed elsewhere
# palantir: ignore-next-lineIgnores type hints in the next line
# type: ignoreIgnores all type hints if placed at the beginning of the file; ignores type hints for the specific line if placed elsewhere
# noqaIgnores type hints in the same line