mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Prettier
This commit is contained in:
@@ -12,7 +12,7 @@ buildSync({
|
||||
external: ["vscode"],
|
||||
platform: "node",
|
||||
format: "cjs",
|
||||
|
||||
|
||||
// The following settings are required to allow for extension debugging
|
||||
minify: false,
|
||||
sourcemap: true,
|
||||
|
||||
@@ -13,7 +13,6 @@ export const DEBUG_CONFIGURATION: vscode.DebugConfiguration = {
|
||||
cwd: "${workspaceFolder}",
|
||||
stopOnEntry: false,
|
||||
watchMode: false,
|
||||
|
||||
};
|
||||
|
||||
export const RUN_CONFIGURATION: vscode.DebugConfiguration = {
|
||||
@@ -83,7 +82,7 @@ function debugFileCommand(resource?: vscode.Uri) {
|
||||
}
|
||||
|
||||
function injectDebugTerminal(terminal: vscode.Terminal): void {
|
||||
if (!getConfig("debugTerminal.enabled")) return
|
||||
if (!getConfig("debugTerminal.enabled")) return;
|
||||
|
||||
const { name, creationOptions } = terminal;
|
||||
if (name !== "JavaScript Debug Terminal") {
|
||||
@@ -246,4 +245,3 @@ function getRuntime(scope?: vscode.ConfigurationScope): string {
|
||||
function getConfig<T>(path: string, scope?: vscode.ConfigurationScope) {
|
||||
return vscode.workspace.getConfiguration("bun", scope).get<T>(path);
|
||||
}
|
||||
|
||||
@@ -1,37 +1,35 @@
|
||||
export function styleLockfile(preview: string) {
|
||||
// Match all lines that don't start with a whitespace character
|
||||
const lines = preview.split(/\n(?!\s)/);
|
||||
// Match all lines that don't start with a whitespace character
|
||||
const lines = preview.split(/\n(?!\s)/);
|
||||
|
||||
return lines.map(styleSection).join('\n')
|
||||
return lines.map(styleSection).join("\n");
|
||||
}
|
||||
|
||||
function styleSection(section: string) {
|
||||
const lines = section.split(/\n/);
|
||||
const lines = section.split(/\n/);
|
||||
|
||||
return lines.map(styleLine).join('\n')
|
||||
return lines.map(styleLine).join("\n");
|
||||
}
|
||||
|
||||
function styleLine(line: string) {
|
||||
if(line.startsWith('#')){
|
||||
return `<span class="mtk5">${line}</span>`
|
||||
}
|
||||
if (line.startsWith("#")) {
|
||||
return `<span class="mtk5">${line}</span>`;
|
||||
}
|
||||
|
||||
const parts = line.trim().split(' ')
|
||||
if(line.startsWith(' ')){
|
||||
return `<span><span class="mtk1"> ${parts[0]} </span><span class="mtk16">${parts[1]}</span></span>`
|
||||
}
|
||||
if(line.startsWith(' ')){
|
||||
const leftPart = `<span class="mtk6"> ${parts[0]} </span>`
|
||||
const parts = line.trim().split(" ");
|
||||
if (line.startsWith(" ")) {
|
||||
return `<span><span class="mtk1"> ${parts[0]} </span><span class="mtk16">${parts[1]}</span></span>`;
|
||||
}
|
||||
if (line.startsWith(" ")) {
|
||||
const leftPart = `<span class="mtk6"> ${parts[0]} </span>`;
|
||||
|
||||
if(parts.length === 1)
|
||||
return `<span>${leftPart}</span>`
|
||||
|
||||
if(parts[1].startsWith('"http://') || parts[1].startsWith('"https://'))
|
||||
return `<span>${leftPart}<span class="mtk12 detected-link">${parts[1]}</span></span>`
|
||||
if(parts[1].startsWith('"'))
|
||||
return `<span>${leftPart}<span class="mtk16">${parts[1]}</span></span>`
|
||||
|
||||
return `<span>${leftPart}<span class="mtk6">${parts[1]}</span></span>`
|
||||
}
|
||||
return `<span class="mtk1">${line} </span>`
|
||||
if (parts.length === 1) return `<span>${leftPart}</span>`;
|
||||
|
||||
if (parts[1].startsWith('"http://') || parts[1].startsWith('"https://'))
|
||||
return `<span>${leftPart}<span class="mtk12 detected-link">${parts[1]}</span></span>`;
|
||||
if (parts[1].startsWith('"')) return `<span>${leftPart}<span class="mtk16">${parts[1]}</span></span>`;
|
||||
|
||||
return `<span>${leftPart}<span class="mtk6">${parts[1]}</span></span>`;
|
||||
}
|
||||
return `<span class="mtk1">${line} </span>`;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ function registerHoverProvider(context: vscode.ExtensionContext) {
|
||||
return;
|
||||
}
|
||||
|
||||
const terminal = vscode.window.createTerminal({name});
|
||||
const terminal = vscode.window.createTerminal({ name });
|
||||
terminal.show();
|
||||
terminal.sendText(`bun ${script}`);
|
||||
}),
|
||||
|
||||
@@ -2636,9 +2636,9 @@ describe("expect()", () => {
|
||||
|
||||
expect({ a: [1, 2, 3] }).toMatchObject({ a: expect.arrayContaining([1, 2]) });
|
||||
expect({ a: [1, 2, 3] }).not.toMatchObject({ a: expect.arrayContaining([4]) });
|
||||
expect({ a: ['hello', 'world'] }).toMatchObject({ a: expect.arrayContaining([]) });
|
||||
expect({ a: ['hello', 'world'] }).toMatchObject({ a: expect.arrayContaining(['world']) });
|
||||
expect({ a: ['hello', 'world'] }).not.toMatchObject({ a: expect.arrayContaining(['hello', 'mars']) });
|
||||
expect({ a: ["hello", "world"] }).toMatchObject({ a: expect.arrayContaining([]) });
|
||||
expect({ a: ["hello", "world"] }).toMatchObject({ a: expect.arrayContaining(["world"]) });
|
||||
expect({ a: ["hello", "world"] }).not.toMatchObject({ a: expect.arrayContaining(["hello", "mars"]) });
|
||||
|
||||
expect([]).toMatchObject([]);
|
||||
expect([]).toMatchObject({});
|
||||
|
||||
@@ -67,7 +67,7 @@ describe("fs.watch", () => {
|
||||
const root = path.join(testDir, "add-directory");
|
||||
try {
|
||||
fs.mkdirSync(root);
|
||||
} catch { }
|
||||
} catch {}
|
||||
let err: Error | undefined = undefined;
|
||||
const watcher = fs.watch(root, { signal: AbortSignal.timeout(3000) });
|
||||
watcher.on("change", (event, filename) => {
|
||||
@@ -102,7 +102,7 @@ describe("fs.watch", () => {
|
||||
const root = path.join(testDir, "add-subdirectory");
|
||||
try {
|
||||
fs.mkdirSync(root);
|
||||
} catch { }
|
||||
} catch {}
|
||||
const subfolder = path.join(root, "subfolder");
|
||||
fs.mkdirSync(subfolder);
|
||||
const watcher = fs.watch(root, { recursive: true, signal: AbortSignal.timeout(3000) });
|
||||
@@ -438,7 +438,7 @@ describe("fs.promises.watch", () => {
|
||||
const root = path.join(testDir, "add-promise-directory");
|
||||
try {
|
||||
fs.mkdirSync(root);
|
||||
} catch { }
|
||||
} catch {}
|
||||
let success = false;
|
||||
let err: Error | undefined = undefined;
|
||||
try {
|
||||
@@ -480,7 +480,7 @@ describe("fs.promises.watch", () => {
|
||||
const root = path.join(testDir, "add-promise-subdirectory");
|
||||
try {
|
||||
fs.mkdirSync(root);
|
||||
} catch { }
|
||||
} catch {}
|
||||
const subfolder = path.join(root, "subfolder");
|
||||
fs.mkdirSync(subfolder);
|
||||
let success = false;
|
||||
|
||||
Reference in New Issue
Block a user