Skip to content

Commit 5cde40f

Browse files
authored
Document uv integration and workspace trust settings (#4339)
1 parent b4cd792 commit 5cde40f

1 file changed

Lines changed: 120 additions & 1 deletion

File tree

‎docs/reference/editor-settings.md‎

Lines changed: 120 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,11 +668,78 @@ ______________________________________________________________________
668668
The following settings are required when ty is initialized in an editor. These settings are
669669
static so changing them requires restarting the editor to take effect.
670670

671-
For VS Code users, these settings are defined in the `ty.*` namespace as usual, but for other
671+
For VS Code users, most of these settings are defined in the `ty.*` namespace as usual, but for other
672672
editors, they would need to be provided in a separate field of the configuration that corresponds to
673673
the initialization options. Refer to the examples below for how to set these options in different
674674
editors.
675675

676+
### `experimental.useUv`
677+
678+
Control how ty uses [uv](https://docs.astral.sh/uv/):
679+
680+
- `off`: Do not use uv.
681+
- `scripts`: Use uv to create and update environments for standalone scripts with
682+
[PEP 723 inline metadata](https://peps.python.org/pep-0723/).
683+
- `on`: Use uv for project discovery and standalone script environments.
684+
685+
This feature is experimental and may change. Enabling it requires
686+
[uv 0.12.3 or later](https://docs.astral.sh/uv/getting-started/installation/). All uv integrations are disabled when
687+
[`untrustedWorkspace`](#untrustedworkspace) is `true`.
688+
689+
**Default value**: `null`
690+
691+
**Type**: `"off" | "scripts" | "on"`
692+
693+
**Example usage**:
694+
695+
=== "VS Code"
696+
697+
```json
698+
{
699+
"ty.experimental.useUv": "scripts"
700+
}
701+
```
702+
703+
=== "Neovim"
704+
705+
```lua
706+
-- Neovim >=0.11:
707+
vim.lsp.config('ty', {
708+
init_options = {
709+
experimental = {
710+
useUv = 'scripts',
711+
},
712+
},
713+
})
714+
715+
-- Neovim <0.11:
716+
require('lspconfig').ty.setup({
717+
init_options = {
718+
experimental = {
719+
useUv = 'scripts',
720+
},
721+
},
722+
})
723+
```
724+
725+
=== "Zed"
726+
727+
```json
728+
{
729+
"lsp": {
730+
"ty": {
731+
"initialization_options": {
732+
"experimental": {
733+
"useUv": "scripts"
734+
}
735+
}
736+
}
737+
}
738+
}
739+
```
740+
741+
______________________________________________________________________
742+
676743
### `logFile`
677744

678745
Path to the file to which the language server writes its log messages. By default, ty writes log messages to stderr.
@@ -775,4 +842,56 @@ The log level to use for the language server.
775842
}
776843
```
777844

845+
______________________________________________________________________
846+
847+
### `untrustedWorkspace`
848+
849+
Whether the language server should treat the workspace as untrusted. When `true`, ty does not run
850+
external commands. This disables all uv integrations.
851+
852+
**Default value**: `false`
853+
854+
**Type**: `boolean`
855+
856+
**Example usage**:
857+
858+
=== "VS Code"
859+
860+
The extension sets this option automatically based on
861+
[Workspace Trust](https://code.visualstudio.com/docs/editing/workspaces/workspace-trust).
862+
There is no `ty.untrustedWorkspace` setting. Open the workspace in Restricted Mode to mark it
863+
as untrusted.
864+
865+
=== "Neovim"
866+
867+
```lua
868+
-- Neovim >=0.11:
869+
vim.lsp.config('ty', {
870+
init_options = {
871+
untrustedWorkspace = true,
872+
},
873+
})
874+
875+
-- Neovim <0.11:
876+
require('lspconfig').ty.setup({
877+
init_options = {
878+
untrustedWorkspace = true,
879+
},
880+
})
881+
```
882+
883+
=== "Zed"
884+
885+
```json
886+
{
887+
"lsp": {
888+
"ty": {
889+
"initialization_options": {
890+
"untrustedWorkspace": true
891+
}
892+
}
893+
}
894+
}
895+
```
896+
778897
[ty-vscode]: https://marketplace.visualstudio.com/items?itemName=astral-sh.ty

0 commit comments

Comments
 (0)