Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nhedger committed Aug 19, 2024
1 parent 60baa26 commit 1bfbcab
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 14 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,5 @@ jobs:
uses: biomejs/setup-biome@v2
- name: Run Biome
run: biome ci --reporter=github

test:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4


31 changes: 31 additions & 0 deletions src/binary-finder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { delimiter } from "node:path";
import { Uri } from "vscode";
import { getLspBin } from "./config";
import { downloadBiome } from "./downloader";
import { info } from "./logger";
import {
binaryName,
fileExists,
Expand Down Expand Up @@ -273,6 +274,12 @@ export const findBiomeLocally = async (
): Promise<BinaryFinderResult> => {
const binPathInSettings = await vsCodeSettingsStrategy.find(path);
if (binPathInSettings) {
info("Found biome binary", {
project: path.fsPath,
bin: binPathInSettings.fsPath,
strategy: vsCodeSettingsStrategy.name,
});

return {
bin: binPathInSettings,
strategy: vsCodeSettingsStrategy,
Expand All @@ -281,6 +288,12 @@ export const findBiomeLocally = async (

const binPathInNodeModules = await nodeModulesStrategy.find(path);
if (binPathInNodeModules) {
info("Found biome binary", {
project: path.fsPath,
bin: binPathInNodeModules.fsPath,
strategy: nodeModulesStrategy.name,
});

return {
bin: binPathInNodeModules,
strategy: nodeModulesStrategy,
Expand All @@ -289,6 +302,12 @@ export const findBiomeLocally = async (

const binPathInYarnPnP = await yarnPnpStrategy.find(path);
if (binPathInYarnPnP) {
info("Found biome binary", {
project: path.fsPath,
bin: binPathInYarnPnP.fsPath,
strategy: yarnPnpStrategy.name,
});

return {
bin: binPathInYarnPnP,
strategy: yarnPnpStrategy,
Expand All @@ -298,6 +317,12 @@ export const findBiomeLocally = async (
const binPathInPathEnvironmentVariable =
await pathEnvironmentVariableStrategy.find();
if (binPathInPathEnvironmentVariable) {
info("Found biome binary", {
project: path.fsPath,
bin: binPathInPathEnvironmentVariable.fsPath,
strategy: pathEnvironmentVariableStrategy.name,
});

return {
bin: binPathInPathEnvironmentVariable,
strategy: pathEnvironmentVariableStrategy,
Expand All @@ -306,6 +331,12 @@ export const findBiomeLocally = async (

const downloadedBinPath = await downloadBiomeStrategy.find();
if (downloadedBinPath) {
info("Found biome binary", {
project: path.fsPath,
bin: downloadedBinPath.fsPath,
strategy: downloadBiomeStrategy.name,
});

return {
bin: downloadedBinPath,
strategy: downloadBiomeStrategy,
Expand Down
6 changes: 3 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const listenForConfigurationChanges = () => {
}),
);

info("Listening for configuration changes");
info("Started listening for configuration changes");
};

/**
Expand All @@ -85,7 +85,7 @@ const listenForActiveTextEditorChange = () => {
}),
);

info("Listening for active text editor changes");
info("Started listening for active text editor changes");

updateActiveProject(window.activeTextEditor);
};
Expand Down Expand Up @@ -116,7 +116,7 @@ const listenForLockfilesChanges = () => {
restart();
});

info("Listening for lockfile changes");
info("Started listening for lockfile changes");

state.context.subscriptions.push(watcher);
};
4 changes: 2 additions & 2 deletions src/lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const stop = async () => {
state.state = "stopping";
await doStop();
state.state = "stopped";
info("Biome extension stopped");
info("Biome extension stopped");
};

/**
Expand All @@ -41,7 +41,7 @@ const doStart = async () => {
await createGlobalSession();
await createProjectSessions();
} catch (e) {
error("Failed to start Biome extension", e);
error("Failed to start Biome extension");
state.state = "error";
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export const log = (
args?: LogArguments,
) => {
if (args) {
message = `${message} ${Object.entries(args)
message = `${message}\n\t${Object.entries(args)
.map(([key, value]) => `${key}=${value}`)
.join(", ")}`.trim();
.join("\n\t")}`.trim();
}

switch (level) {
Expand Down

0 comments on commit 1bfbcab

Please sign in to comment.