Skip to content

Commit 14f9042

Browse files
deadlyjackAjit Kumar
andauthored
fix: run new files even if marked saved (#2360)
* fix: run new files even if marked saved * fix --------- Co-authored-by: Ajit Kumar <dellevenjack@gmail>
1 parent 87e388d commit 14f9042

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/lib/run.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,15 @@ async function run(
260260
if (pathName) {
261261
url = Url.join(pathName, reqPath);
262262
file = editorManager.getFile(url, "uri");
263-
} else if (!activeFile.uri) {
263+
} else if (!activeFile.uri && filename === reqPath) {
264264
file = activeFile;
265265
}
266266

267+
if (!url && !file) {
268+
error(reqId);
269+
return;
270+
}
271+
267272
// Handle extensionless URLs (e.g., "about" -> "about.html" or "about/index.html")
268273
if (!ext && pathName) {
269274
// Try exact match first for extensionless files (LICENSE, README, etc.)
@@ -302,7 +307,7 @@ async function run(
302307
switch (ext) {
303308
case ".htm":
304309
case ".html":
305-
if (file && file.loaded && file.isUnsaved) {
310+
if (!url || (file && file.loaded && file.isUnsaved)) {
306311
sendHTML(file.session?.doc?.toString(), reqId);
307312
} else {
308313
sendFileContent(url, reqId, MIMETYPE_HTML);
@@ -331,7 +336,7 @@ async function run(
331336
break;
332337

333338
default:
334-
if (file && file.loaded && file.isUnsaved) {
339+
if (!url || (file && file.loaded && file.isUnsaved)) {
335340
sendText(
336341
file.session?.doc?.toString(),
337342
reqId,

0 commit comments

Comments
 (0)