Skip to content

Commit 2807bed

Browse files
authored
Merge pull request #254 from levrado/fix_bug_with_scoped_package_path
fix issue with `@` symbol in relative path
2 parents 7a66d53 + 36c549d commit 2807bed

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/languageservice/utils/paths.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { join, normalize } from 'path';
33
import { URI } from 'vscode-uri';
44

55
export const isRelativePath = (path: string): boolean => {
6-
const relativePathRegex = /^(((\.\.?)|([\w-\. ]+))(\/|\\\\?))*[\w-\. ]*\.[\w-]+$/i;
6+
const relativePathRegex = /^(((\.\.?)|([\w-@\. ]+))(\/|\\\\?))*[\w-\. ]*\.[\w-]+$/i;
77
return relativePathRegex.test(path);
88
};
99

test/paths.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ suite('File path tests', () => {
132132
'file:///usr/testuser/relative/path/file.json',
133133
'file:///c%3A/Users/testuser/relative/path/file.json');
134134

135+
checkGoodPath(join('..', '..', 'relative', '@path', 'file.json'),
136+
'file:///relative/%40path/file.json',
137+
'file:///usr/testuser/relative/%40path/file.json',
138+
'file:///c%3A/Users/testuser/relative/%40path/file.json');
139+
135140
describe('Relative path = a workspace folder', () => {
136141
const path1 = join('aFolder', 'file.json');
137142
const path2 = join('folder-2', 'file.json');

0 commit comments

Comments
 (0)