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

Remote server does not load custom file paths correctly! #291

Open
McfhHolmes0 opened this issue Sep 19, 2024 · 1 comment
Open

Remote server does not load custom file paths correctly! #291

McfhHolmes0 opened this issue Sep 19, 2024 · 1 comment
Labels

Comments

@McfhHolmes0
Copy link

McfhHolmes0 commented Sep 19, 2024

Describe the bug

My daily development work is done by connecting to a remote server via Remote-ssh under Windows 10.

I defined a custom template and specified the path:

  "autoDocstring.customTemplatePath": "C:\\Users\\user\\.vscode\\custom-extensions-config\\njpwerner.autodocstring-templates\\google-custom.mustache",

This is set up to develop under Windows without any problems, but when I'm connecting to a remote server("Ubuntu 22.04.5 LTS"), I'm unable to find this .mustache template file. The error is following:

[ERROR 13:45:39.990] Error: ENOENT: no such file or directory, open '/user/Bob/projects/demo/C:\Users\McfhHolmes\.vscode\custom-extensions-config\njpwerner.autodocstring-templates\google-custom.mustache'
	at getCustomTemplate <autoDocstring>/out/docstring/get_template.js:17:34
	at AutoDocstring.getTemplate <autoDocstring>/out/generate_docstring.js:56:53
	at AutoDocstring.generateDocstringSnippet <autoDocstring>/out/generate_docstring.js:35:80
	at AutoDocstring.generateDocstring <autoDocstring>/out/generate_docstring.js:23:39
	at  <autoDocstring>/out/extension.js:16:3

One solution would be to place the template files under the project folder and use relative paths, but then a copy of the template file would have to be stored under each project folder. Is there any solution that will make it easy for me to develop either under windows or through remote connection to the server.

Versions:

  • autoDocstring Version: v0.6.1
  • Operating System: Windows10
  • Vscode Version: 1.93.1
@McfhHolmes0
Copy link
Author

This issue has been resolved!

The Vscode settings file is divided into local user configuration and remote server configuration. The remote server(Linux) configuration is usually located in ~/.vscode-server/data/Machine/settings.json.

The ~ here refers to your Linux home directory. For example, my linux username is bob, so my home directory is /home/bob. Then the path above means: /home/bob/.vscode-server/data/Machine/settings.json.

Note that if you are the root user, then your home directory is /root.

So you only need to set the custom configuration file path in this file. For example, my configuration file path is:/home/bob/.vscode-server/custom-extensions-config/njpwerner.autodocstring-templates/google-custom.mustache. I just need to set the path in the above mentioned remote server's setting.json file to add a line of configuration:

  "autoDocstring.customTemplatePath": "/home/bob/.vscode-server/custom-extensions-config/njpwerner.autodocstring-templates/google-custom.mustache",

Then the template file on the remote server will be loaded correctly. Note that the home directory /home/bob cannot be replaced by ~ here. Otherwise, the template path will not be recognized correctly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant