iamcco / iamcco/coc-project

coc-project does not find the project root correctly when vim is launched deep in the directory tree without a filename

Open
#6 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
18
Forks
0
PR merge metrics
No merged PRs in 30d

Description

I have a project in a directory `$HOME/test`. This is the root directory where `.git` resides. Then I created folders `b/c/d/e/` in the project root so that the directory tree looks like the following:

```sh
test
├── b
│   └── c
│   └── d
│   └── e
└── .git
```

If I go the the directory `d`, and open `vi` with a filename: `vi file.txt`. Then I check the current working directory with `:echo getcwd()`, it prints `/home/xxx/test` correctly. If I open `vim` without a filename, i.e. just do `vi` and then `:echo getcwd()`, it still prints `/home/xxx/test` correctly.

If I go to directory `e` and do `vi file.txt`. `:echo getcwd()` still prints the project root correctly. However, if I do `vi` without a filename in directory `e`, `:echo getcwd()` prints `/home/xxx/test/b/c/d/e`. It prints the current directory instead of the project root.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue by launching Vim without a filename from the nested directory described in the report, then compare it with launching Vim with file.txt. Locate the project-root detection entry point and verify that both cases resolve /home/xxx/test; done means the no-filename case also reports the project root.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vim
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.