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

Cygwin paths #1003

Closed
cosminadrianpopescu opened this issue Jul 19, 2019 · 10 comments
Closed

Cygwin paths #1003

cosminadrianpopescu opened this issue Jul 19, 2019 · 10 comments

Comments

@cosminadrianpopescu
Copy link
Contributor

Result from CocInfo

versions

vim version: VIM - Vi IMproved 8.1 (2018 May 18, compiled Mar 9 2019 11:57:58)
node version: v8.11.1
coc.nvim version: 0.0.72-8c7241d7e3
term: dumb
platform: win32

Messages

Messages maintainer: Bram Moolenaar Bram@vim.org
"src/workspace.ts" 1625L, 56117C

Output channel: tsserver

[Info - 20:21:42] Forking TSServer
PATH: C:\Users\Public\Documents\CYGWIN...
[Info - 20:21:43] Started TSServer
{
"path": "\cygdrive\c\home\T9A090\dotfiles\vim\disabled\coc.nvim-git\node_modules\typescript\lib",
"_api": {
"versionString": "3.5.3",
"version": "3.5.3"
}
}

Output channel: angularls

Search path: /cygdrive/c/home/T9A090/dotfiles/vim/disabled/coc.nvim-git/src
Config file name: /cygdrive/c/home/T9A090/dotfiles/vim/disabled/coc.nvim-git/tsconfig.json
Angular Language Service: 8.1.1
TypeScript: 3.4.5
getTemplateReferences: 1482ms
Add recursive watcher for: /cygdrive/c/home/T9A090/dotfiles/vim/disabled/coc.nvim-git
Opened configuration file /cygdrive/c/home/T9A090/dotfiles/vim/disabled/coc.nvim-git/tsconfig.json
getCompletions: 133ms
getCompletions: 249ms
getCompletions: 2ms
getDefinitionAt: 83ms
getDiagnostics: 12ms
updating project structure from ...
updated: ng - 430ms
Search path: /cygdrive/c/cygdrive/c/home/T9A090/dotfiles/vim/disabled/coc.nvim-git/src/util
Config file name: /cygdrive/c/cygdrive/c/home/T9A090/dotfiles/vim/disabled/coc.nvim-git/tsconfig.json
Angular Language Service: 8.1.1
TypeScript: 3.4.5
getTemplateReferences: 1440ms
Add recursive watcher for: /cygdrive/c/cygdrive/c/home/T9A090/dotfiles/vim/disabled/coc.nvim-git
Opened configuration file /cygdrive/c/cygdrive/c/home/T9A090/dotfiles/vim/disabled/coc.nvim-git/tsconfig.json
getDiagnostics: 1ms

Describe the bug

Opening files from cygwin (when node is a windows process) will set the paths with a back slash (\). I was thinking that maybe there is a global point where I can change the paths, so my vim will not have to open files like \cygdrive\c\Users...

Reproduce the bug

In cygwin, go to the coc.nvim folder, open vim, open workspace.ts, then go with the cursor on top of findUp in the import line (import {findUp...) and execute command :call CocAction('jumpDefinition'). The open buffer will be \cygdrive\c\... (notice the back slashes). I would like to create a PR which will change the paths to /cygdrive/c/..., but I can't seem to find the place where to change those files (again, I don't seem to grasp the architecture of the project).

@chemzqm
Copy link
Member

chemzqm commented Jul 19, 2019

@cosminadrianpopescu
Copy link
Contributor Author

Awesome. Thank you very much. There is PR for this.

However, is there also a place to change the paths in the other direction? I mean the paths that are sent by a cygwin vim process to the node windows process. That's because, for example, even though I am in a given folder, the vim instance is going to send an absolute path.

If I am in the folder /cygdrive/c/Users/My/coc.nvim and there I edit the file autoload/coc/util.vim, the path received by the node daeomn is /cygdrive/c/Users/My/coc.nvim/autoloat/coc/util.vim, instead of ./autoload/coc/util.vim. This is going to be translated by the node daemon as 'c:/cygdrive/c/Users/.... Of course, this folder does not exists.

Right now, to fix it, I need to have a windows junction. But sometimes, I am not able to create the junction (lack of admin rights).

I would like to also have a PR for the place where coc.vim sends the paths to the node process, in order to be able to change /cygdrive/c/ with c:/ based on some preferences.

Thank you very much.

@chemzqm
Copy link
Member

chemzqm commented Jul 20, 2019

What you get by node -e 'console.log(os.platform())' ?

@chemzqm
Copy link
Member

chemzqm commented Jul 20, 2019

Should be able to fix the problem by change https://github.com/neoclide/coc.nvim/blob/master/src/util/index.ts#L47

@cosminadrianpopescu
Copy link
Contributor Author

What you get by node -e 'console.log(os.platform())' ?

I get windows (the node is not compiled under cygwin, unlike vim).

@chemzqm
Copy link
Member

chemzqm commented Jul 20, 2019

I think you should compile it under cygwin, so it knows how to handle uri as expected.

@cosminadrianpopescu
Copy link
Contributor Author

Yes, I completely agree with you. but that easier said than done. I actually started with compiling in my mind, but it's not that easy. Node is using libuv for the event loop, and for a long while libuv was not compilable in cygwin. Recently apparently you can compile libuv in cygwin, but I didn't succeeded. I've compiled a libuv and linked it without errors and then I've compiled neovim. But I can tell you that any operation in nvim requiring libuv is not actually working properly.

Because of the libuv dependency and because of the fact that actually node works quite well from inside cygwins mintty, there was really no effort to compile node under cygwin. So I would be in uncharted territory (not that much info). However, I've tried and didn't succeeded yet.

So, until I will succeed, I have to try these workarounds.

@cosminadrianpopescu
Copy link
Contributor Author

Check this out:

nodejs/node#4716

So, it appears that even if I would succeed in building it, it would still have the same path issues.

@cosminadrianpopescu
Copy link
Contributor Author

Meanwhile, I added another commit to the PR #1005 which should solve the reverse problem (paths from node to vim process). One last thing remaining (I think this will be more complicated). I notice now that when using codeAction, if I import something in with coc-tsserver, I might get a full path, like ./c:/Users/myUser/workspace/project/node_modules/@angular/core instead of @angular/core. Any idea where this is handled?

Thank you very much for your support.

@chemzqm
Copy link
Member

chemzqm commented May 3, 2020

Use g:g:coc_uri_prefix_replace_patterns

@chemzqm chemzqm closed this as completed May 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants