Skip to content

Commit ec0f4da

Browse files
committed
fix(relativePath) prefer external modules
1 parent cb47a6c commit ec0f4da

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

Diff for: dist/main/lang/projectService.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -549,21 +549,22 @@ function getRelativePathsInProject(query) {
549549
var project = getOrCreateProject(query.filePath);
550550
var sourceDir = path.dirname(query.filePath);
551551
var filePaths = project.projectFile.project.files.filter(function (p) { return p !== query.filePath; });
552-
var files = filePaths.map(function (p) {
553-
return {
554-
name: path.basename(p, '.ts'),
555-
relativePath: tsconfig.removeExt(tsconfig.makeRelativePath(sourceDir, p)),
556-
fullPath: p
557-
};
558-
});
552+
var files = [];
559553
if (query.includeExternalModules) {
560554
var externalModules = getExternalModules_1.getExternalModuleNames(project.languageService.getProgram());
561555
externalModules.forEach(function (e) { return files.push({
562-
name: "module \"" + e + "\"",
556+
name: "" + e,
563557
relativePath: e,
564558
fullPath: e
565559
}); });
566560
}
561+
filePaths.forEach(function (p) {
562+
files.push({
563+
name: path.basename(p, '.ts'),
564+
relativePath: tsconfig.removeExt(tsconfig.makeRelativePath(sourceDir, p)),
565+
fullPath: p
566+
});
567+
});
567568
var endsInPunctuation = prefixEndsInPunctuation(query.prefix);
568569
if (!endsInPunctuation)
569570
files = fuzzaldrin.filter(files, query.prefix, { key: 'name' });

Diff for: lib/main/lang/projectService.ts

+14-9
Original file line numberDiff line numberDiff line change
@@ -844,24 +844,29 @@ export function getRelativePathsInProject(query: GetRelativePathsInProjectQuery)
844844
var project = getOrCreateProject(query.filePath);
845845
var sourceDir = path.dirname(query.filePath);
846846
var filePaths = project.projectFile.project.files.filter(p=> p !== query.filePath);
847-
848-
var files = filePaths.map(p=> {
849-
return {
850-
name: path.basename(p, '.ts'),
851-
relativePath: tsconfig.removeExt(tsconfig.makeRelativePath(sourceDir, p)),
852-
fullPath: p
853-
};
854-
});
847+
var files: {
848+
name: string;
849+
relativePath: string;
850+
fullPath: string;
851+
}[] = [];
855852

856853
if (query.includeExternalModules) {
857854
var externalModules = getExternalModuleNames(project.languageService.getProgram());
858855
externalModules.forEach(e=> files.push({
859-
name: `module "${e}"`,
856+
name: `${e}`,
860857
relativePath: e,
861858
fullPath: e
862859
}));
863860
}
864861

862+
filePaths.forEach(p=> {
863+
files.push({
864+
name: path.basename(p, '.ts'),
865+
relativePath: tsconfig.removeExt(tsconfig.makeRelativePath(sourceDir, p)),
866+
fullPath: p
867+
});
868+
});
869+
865870
var endsInPunctuation: boolean = prefixEndsInPunctuation(query.prefix);
866871

867872
if (!endsInPunctuation)

0 commit comments

Comments
 (0)