Merge pull request #2633 from kylewlacy/fix-workspace-check
Fix false positives when checking if a file is in a workspace
This commit is contained in:
commit
6a9b7615e1
1 changed files with 4 additions and 1 deletions
|
|
@ -268,7 +268,10 @@ export class CompletionProvider {
|
|||
const workspaceDirs = await this.ide.getWorkspaceDirs();
|
||||
let filepath = input.filepath;
|
||||
for (const workspaceDir of workspaceDirs) {
|
||||
if (filepath.startsWith(workspaceDir)) {
|
||||
const relativePath = path.relative(workspaceDir, filepath);
|
||||
const relativePathBase = relativePath.split(path.sep).at(0);
|
||||
const isInWorkspace = !path.isAbsolute(relativePath) && relativePathBase !== "..";
|
||||
if (isInWorkspace) {
|
||||
filepath = path.relative(workspaceDir, filepath);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue