Skip to content

Commit

Permalink
chore: introduce prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
cijiugechu authored and lpil committed Aug 14, 2023
1 parent 1be5bee commit a921828
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/**/*
out/**/*
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"trailingComma": "es5",
"semi": true,
"singleQuote": false,
"endOfLine": "lf",
"arrowParens": "always"
}
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
"compile": "webpack --mode development",
"compile-watch": "webpack --mode development --watch",
"test-compile": "tsc -p ./",
"vscode:package": "vsce package"
"vscode:package": "vsce package",
"format": "prettier ./**/*.ts --write --cache"
},
"devDependencies": {
"@types/glob": "^7.1.3",
Expand All @@ -80,6 +81,7 @@
"eslint": "^7.15.0",
"glob": "^7.1.6",
"mocha": "^10.1.0",
"prettier": "^3.0.1",
"ts-loader": "^8.0.13",
"typescript": "^4.1.2",
"vsce": "^2.15.0",
Expand Down
31 changes: 17 additions & 14 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,27 @@ export function activate(context: vscode.ExtensionContext) {
onEnterRules,
});

const restartCommand = vscode.commands.registerCommand(GleamCommands.RestartServer, async () => {
if (!client) {
vscode.window.showErrorMessage("gleam client not found");
return;
}
const restartCommand = vscode.commands.registerCommand(
GleamCommands.RestartServer,
async () => {
if (!client) {
vscode.window.showErrorMessage("gleam client not found");
return;
}

try {
if (client.isRunning()) {
await client.restart();
try {
if (client.isRunning()) {
await client.restart();

vscode.window.showInformationMessage("gleam server restarted.");
} else {
await client.start();
vscode.window.showInformationMessage("gleam server restarted.");
} else {
await client.start();
}
} catch (err) {
client.error("Restarting client failed", err, "force");
}
} catch (err) {
client.error("Restarting client failed", err, "force");
}
});
);

context.subscriptions.push(restartCommand);

Expand Down

0 comments on commit a921828

Please sign in to comment.