mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-08-08 09:53:20 +02:00
Feedback: Hugo with partial content in modules vs. Dashboard #602
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
- [#591](https://github.com/estruyf/vscode-front-matter/issues/591): Support for date format in the `datetime` field
|
||||
- [#593](https://github.com/estruyf/vscode-front-matter/issues/593): Add support for date formatting in the preview path
|
||||
- [#599](https://github.com/estruyf/vscode-front-matter/issues/599): Add a placeholder when the base panel view is empty
|
||||
- [#602](https://github.com/estruyf/vscode-front-matter/issues/602): Find content outside the Front Matter workspace folder
|
||||
|
||||
### ⚡️ Optimizations
|
||||
|
||||
|
||||
+23
-2
@@ -272,7 +272,8 @@ export class Folders {
|
||||
for (const folder of folders) {
|
||||
try {
|
||||
const folderPath = parseWinPath(folder.path);
|
||||
let projectStart = parseWinPath(folder.path).replace(wsFolder, '');
|
||||
// let projectStart = parseWinPath(folder.path).replace(wsFolder, '');
|
||||
let projectStart = folderPath;
|
||||
|
||||
if (typeof projectStart === 'string') {
|
||||
projectStart = projectStart.replace(/\\/g, '/');
|
||||
@@ -291,7 +292,8 @@ export class Folders {
|
||||
filePath = `*${fileType.startsWith('.') ? '' : '.'}${fileType}`;
|
||||
}
|
||||
|
||||
let foundFiles = await workspace.findFiles(filePath, '**/node_modules/**');
|
||||
let foundFiles = await Folders.findFiles(filePath);
|
||||
|
||||
// Make sure these file are coming from the folder path (this could be an issue in multi-root workspaces)
|
||||
foundFiles = foundFiles.filter((f) => parseWinPath(f.fsPath).startsWith(folderPath));
|
||||
|
||||
@@ -461,6 +463,11 @@ export class Folders {
|
||||
const isWindows = process.platform === 'win32';
|
||||
let absPath = folder.path.replace(WORKSPACE_PLACEHOLDER, parseWinPath(wsFolder?.fsPath || ''));
|
||||
absPath = isWindows ? absPath.split('/').join('\\') : absPath;
|
||||
|
||||
if (absPath.includes('../')) {
|
||||
absPath = join(absPath);
|
||||
}
|
||||
|
||||
return parseWinPath(absPath);
|
||||
}
|
||||
|
||||
@@ -577,4 +584,18 @@ export class Folders {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Find all files
|
||||
* @param pattern
|
||||
* @returns
|
||||
*/
|
||||
private static async findFiles(pattern: string): Promise<Uri[]> {
|
||||
return new Promise((resolve) => {
|
||||
glob(pattern, { ignore: '**/node_modules/**' }, (err, files) => {
|
||||
const allFiles = files.map((file) => Uri.file(file));
|
||||
resolve(allFiles);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user