You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Opening file from explorer causes trouble when used behind a reverse proxy (2.1698 release) #1294
If the code server is opened without providing a folder via URL parameter, everything is working fine. However, in case the folder parameter is used and the file is opened via the Explorer, the python extension doesn't seem to be able to fully interact with the (python-) file (underlines are missing, formatter is not working...):
However, if the file is opened via File -> Open, a new tab is created and everything is working fine:
Based on the tab labels, it seems like that opening files via File -> Open is using absolute paths while the explorer uses a relative path (which is causing problems with the python extension). This problem does not happen with the older code-server versions (e.g. 2.1692-vsc1.39.2). I also looked into the logs, but wasn't able to find anything suspicious.
To summarize:
Older code-server version -> working
Opening code-server without folder parameter -> working
Thanks for investigating! The underlines are warning/errors from python lintings and that can depend on the python extension settings within VS code. I think the better way of debugging or reproducing this issue is by checking if opening the file via the explorer (file browser) and, subsequently, opening the same file via File -> Open will produce two tabs with the same content (issue) or only one (how it should be).
I also did a bit more investigation and discovered that the issue actually has nothing specific to do with the python extension itself and will, most likely, cause problems with other functionalities and extensions as well. Also, the issue only appears when the VS Code instance is accessed from a base URL (e.g. via a reverse proxy).
Here is an update on the setups I have tested that are working, and the setup which is causing trouble:
Older code-server version -> working
Opening code server without a URL path (e.g. via reverse proxy) -> working
Opening code-server without folder parameter -> working
Opening code-server with a base path and folder parameter:
Open a file with File -> Open -> working
Open a file from explorer -> not working (File opens in a new tab and causes trouble with functionalities that work on the file, e.g. linting...). Here are some errors logged in the Log (Window) section:
changed the title [-]Python extension not working when opening file from explorer (2.1698 release)[/-][+]Opening file from explorer causes trouble when used behind a reverse proxy (2.1698 release)[/+]on Feb 3, 2020
I also renamed the issue since I believe that it is much more related to the usage of code-server behind a reverse proxy, and not explicitly related to the python extension.
I've been doing some test. It does work using my reverse proxy.
It's when using the ?folder= argument in URL that it doesn't work, reverse proxy or not. @lukasmasuch, could you check it out?
My guess is that it has something to do with the workspaces. I've been experiencing something else that I meant to look into: with 2.1692 (vsc1.39.2), ?folder= always worked. Since 2.1698 (vsc1.41.1), sometimes the ?folder= argument isn't considered at all, it just loads the last opened project no matter what.
@lukasmasuch, try this when your bug happens: open the File Menu, select Open, and open the folder of the project you want to work on. It should fix your issue.
I haven't had any luck replicating this so far on 2.1698. The folder
parameter always seems to work for me as expected. I've been trying
various combinations of opening workspaces and folders and changing the
last visited property in the ~/.local/share/code-server/coder.json file.
There was a bug in the logic that saved the last visited folder or
workspace which I fixed some time ago but isn't in a release yet. But
I'm not sure how or if that would cause this issue. Still, maybe it's
worth trying to delete that file and see if it does anything.
I'll keep poking around for a bit and see if I can find anything. If
anyone has any ideas for what I can do to replicate the issue please let
me know. Thanks!
@orditeck@code-asher Thanks for looking into this issue! I put some more time into figuring out an easy way to replicate the issue. And it actually seems like a general problem within code-server and not related to the reverse proxy:
Start code-server via the latest Docker image:
docker run -it -p 8123:8080 codercom/code-server --auth none /home/coder/project
Create a new file within the opened project/folder inside VS Code, e.g.: Explorer -> New File -> test.txt -> at that point you should have one open editor tab in VS Code with the created file.
Open the same file via the menu: Menu -> File -> Open -> test.txt -> at that point another editor tab with the same file should be open:
And this is the issue. The expected behavior would be that no new editor tab is opened for the same (already opened) file. Having two tabs with the same file causes some errors within the VS Code logs. Also, the tab opened via the explorer (the tab which was opened in step 3) does seem to cause various problems with vs-code extensions (e.g., python -> formatting, linting...). As stated above, this only happens when the ?folder= parameter is used. Older versions also do not seem to have this issue.
It's apparently related to #1351. So http://localhost:8080/?folder=vscode-remote%3A%2F%2Flocalhost%3A8080%2Fhome%2Fcoder%2Fproject works but http://localhost:8008/?folder=/home/coder/project doesn't. That explains why I couldn't replicate earlier since I was using the folder picker which uses the former.
So I'll be looking through how they use it and try making it work for both the new format and the old format.
Activity
nhooyr commentedon Jan 27, 2020
Will test and get back to you soon.
nhooyr commentedon Feb 3, 2020
Not sure what's going on here. I get no underline no matter what. Are there any errors in the console?
lukasmasuch commentedon Feb 3, 2020
Thanks for investigating! The underlines are warning/errors from python lintings and that can depend on the python extension settings within VS code. I think the better way of debugging or reproducing this issue is by checking if opening the file via the explorer (file browser) and, subsequently, opening the same file via
File -> Openwill produce two tabs with the same content (issue) or only one (how it should be).I also did a bit more investigation and discovered that the issue actually has nothing specific to do with the python extension itself and will, most likely, cause problems with other functionalities and extensions as well. Also, the issue only appears when the VS Code instance is accessed from a base URL (e.g. via a reverse proxy).
Here is an update on the setups I have tested that are working, and the setup which is causing trouble:
folderparameter -> workingfolderparameter:File -> Open-> workingLog (Window)section:[-]Python extension not working when opening file from explorer (2.1698 release)[/-][+]Opening file from explorer causes trouble when used behind a reverse proxy (2.1698 release)[/+]lukasmasuch commentedon Feb 3, 2020
I also renamed the issue since I believe that it is much more related to the usage of code-server behind a reverse proxy, and not explicitly related to the python extension.
nhooyr commentedon Feb 3, 2020
@code-asher
orditeck commentedon Feb 9, 2020
I have the same issue. I also use a reverse proxy.
Without the reverse proxy (Caddy), it works.2.1692-vsc1.39.2works with the reverse proxy though.orditeck commentedon Feb 9, 2020
Hmm...
I've been doing some test.
It does work using my reverse proxy.
It's when using the
?folder=argument in URL that it doesn't work, reverse proxy or not. @lukasmasuch, could you check it out?My guess is that it has something to do with the workspaces. I've been experiencing something else that I meant to look into: with
2.1692(vsc1.39.2),?folder=always worked. Since2.1698(vsc1.41.1), sometimes the?folder=argument isn't considered at all, it just loads the last opened project no matter what.@lukasmasuch, try this when your bug happens: open the File Menu, select Open, and open the folder of the project you want to work on. It should fix your issue.
code-asher commentedon Feb 10, 2020
lukasmasuch commentedon Feb 11, 2020
@orditeck @code-asher Thanks for looking into this issue! I put some more time into figuring out an easy way to replicate the issue. And it actually seems like a general problem within code-server and not related to the reverse proxy:
http://localhost:8123/?folder=/home/coder/projectExplorer -> New File -> test.txt-> at that point you should have one open editor tab in VS Code with the created file.Menu -> File -> Open -> test.txt-> at that point another editor tab with the same file should be open:And this is the issue. The expected behavior would be that no new editor tab is opened for the same (already opened) file. Having two tabs with the same file causes some errors within the VS Code logs. Also, the tab opened via the explorer (the tab which was opened in step 3) does seem to cause various problems with vs-code extensions (e.g., python -> formatting, linting...). As stated above, this only happens when the
?folder=parameter is used. Older versions also do not seem to have this issue.code-asher commentedon Feb 12, 2020
code-asher commentedon Feb 12, 2020
It's apparently related to #1351. So
http://localhost:8080/?folder=vscode-remote%3A%2F%2Flocalhost%3A8080%2Fhome%2Fcoder%2Fprojectworks buthttp://localhost:8008/?folder=/home/coder/projectdoesn't. That explains why I couldn't replicate earlier since I was using the folder picker which uses the former.So I'll be looking through how they use it and try making it work for both the new format and the old format.
lukasmasuch commentedon Feb 12, 2020
@code-asher Thanks for fixing the issue 👍I really appreciate this work! I will test it once a binary is available.