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

Install LS into dedicated (persistent) global storage #811

Merged
merged 1 commit into from Oct 14, 2021

Conversation

radeksimko
Copy link
Member

Closes #739


This changes where the language server gets installed upon first extension activation, or upgrade.

Previously we would install it under:

(macOS) /Users/radeksimko/.vscode/extensions/hashicorp.terraform-2.15.0/lsp/terraform-ls

now we install it into:

(macOS) /Users/radeksimko/Library/Application Support/Code/User/globalStorage/hashicorp.terraform/bin/terraform-ls

The intended benefit of this change is that LS doesn't need to be re-installed whenever an extension version changes and also we can reduce the likelihood of running into restrictive FS permissions which may rightly be applied to the ~/.vscode in some cases.

@radeksimko radeksimko requested a review from a team October 14, 2021 14:53
@radeksimko radeksimko added the enhancement New feature or request label Oct 14, 2021
@radeksimko radeksimko self-assigned this Oct 14, 2021
Copy link
Contributor

@jpogran jpogran left a comment

Choose a reason for hiding this comment

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

Confirmed installed to $env:APPDATA\Code\User\globalStorage\hashicorp.terraform\bin\terraform-ls.exe, and subsequent starts uses that path

@radeksimko radeksimko merged commit 02c84ac into main Oct 14, 2021
Terraform Editor Experience Public Roadmap automation moved this from In Progress to Done Oct 14, 2021
@radeksimko radeksimko deleted the f-global-storage-install-path branch October 14, 2021 15:14
@husunal
Copy link

husunal commented Oct 15, 2021

Is it possible configure the path? LS stopped working because my company doesn't allow to run executables from the new path.

@radeksimko
Copy link
Member Author

@husunal Just to understand the policy and context, what path(s) your company does allow to run executables from? Also is there any justification that the company has for preventing execution from these paths?

FWIW You can maintain a custom installation by following these steps depending on your platform https://github.com/hashicorp/terraform-ls#installation and setting path in settings under terraform.languageServer > pathToBinary

"pathToBinary": {
"scope": "resource",
"type": "string",
"default": "",
"description": "Path to language server binary (optional)"
},

The downside is that it will not be automatically updated for you - you would have to rely on the relevant package manager in your Linux distribution or Homebrew in macOS.

@husunal
Copy link

husunal commented Oct 15, 2021

We are using VSCODE_EXTENSIONS env variable to install all extensions to the specific allowed path. I'd like to manage it via VS Code extensions, not manually or via package manager so I won't use pathToBinary setting.

It would be good to support VSCODE_EXTENSIONS env var.

@radeksimko
Copy link
Member Author

I see - I didn't even know this variable existed! Thank you for the added context.

I wonder if there is any similar ENV variable that can be used to change the default path for extension data.

https://github.com/microsoft/vscode/blob/39f00c538037546af30ac49d06203b9bb8ddadb3/src/vs/platform/environment/common/environmentService.ts#L87-L88 suggests there isn't, but perhaps VS Code would be open to contributions.

That way you would be able to set that variable (say VSCODE_GLOBAL_STORAGE) to a path that allows execution.

Would that work for you?

@radeksimko
Copy link
Member Author

FWIW the (new) path we use is basically recommended by VS Code for extension to use to persist data and it doesn't seem that unusual to place executables in that path. I can see Microsoft's own extension installs some executables there too:

$ globalStorage tree ms-vscode-remote.remote-containers
ms-vscode-remote.remote-containers
└── cli-bin
    ├── devcontainer
    ├── devcontainer.cmd
    ├── remote-containers-path
    ├── vscode-app-root
    ├── vscode-machine-id
    ├── vscode-path
    └── vscode-quality

1 directory, 7 files

@husunal
Copy link

husunal commented Oct 15, 2021

Any var name or VSCode extension setting that will allow us to configure the path for the language server and doesn't require managing a custom installation would work. As a temporary workaround I downgraded the extension to the previous version.

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Install LS into VS Code recommended path & consider native FS API
3 participants