Skip to content

Commit dc10248

Browse files
Merge pull request #449 from laravel/pint-for-plain-php-projects
Pint for plain PHP projects
2 parents 44db2c8 + 3e22016 commit dc10248

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

src/extension.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@ function shouldActivate(): boolean {
4949
export async function activate(context: vscode.ExtensionContext) {
5050
info("Activating Laravel Extension...");
5151

52+
initPhp();
53+
54+
context.subscriptions.push(
55+
vscode.commands.registerCommand("laravel.open", openFileCommand),
56+
vscode.commands.registerCommand("laravel.runPint", runPint),
57+
vscode.commands.registerCommand(
58+
"laravel.runPintOnCurrentFile",
59+
runPintOnCurrentFile,
60+
),
61+
vscode.commands.registerCommand(
62+
"laravel.runPintOnDirtyFiles",
63+
runPintOnDirtyFiles,
64+
),
65+
);
66+
5267
if (!shouldActivate()) {
5368
info(
5469
'Not activating Laravel Extension because "shouldActivate" returned false',
@@ -95,7 +110,6 @@ export async function activate(context: vscode.ExtensionContext) {
95110

96111
const LANGUAGES = [{ scheme: "file", language: "php" }, ...BLADE_LANGUAGES];
97112

98-
initPhp();
99113
initVendorWatchers();
100114
watchForComposerChanges();
101115
setParserBinaryPath(context);
@@ -104,8 +118,6 @@ export async function activate(context: vscode.ExtensionContext) {
104118

105119
updateDiagnostics(vscode.window.activeTextEditor);
106120

107-
context.subscriptions.push();
108-
109121
const delegatedRegistry = new Registry(
110122
...completionProviders,
111123
new EloquentCompletion(),
@@ -194,16 +206,6 @@ export async function activate(context: vscode.ExtensionContext) {
194206
providedCodeActionKinds: [vscode.CodeActionKind.QuickFix],
195207
},
196208
),
197-
vscode.commands.registerCommand("laravel.open", openFileCommand),
198-
vscode.commands.registerCommand("laravel.runPint", runPint),
199-
vscode.commands.registerCommand(
200-
"laravel.runPintOnCurrentFile",
201-
runPintOnCurrentFile,
202-
),
203-
vscode.commands.registerCommand(
204-
"laravel.runPintOnDirtyFiles",
205-
runPintOnDirtyFiles,
206-
),
207209
);
208210

209211
collectDebugInfo();

src/support/project.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ export const projectPath = (srcPath = ""): string => {
5353
) {
5454
return path.join(workspaceFolder.uri.fsPath, srcPath);
5555
}
56+
57+
if (fs.existsSync(path.join(workspaceFolder.uri.fsPath, srcPath))) {
58+
return path.join(workspaceFolder.uri.fsPath, srcPath);
59+
}
5660
}
5761

5862
return "";

src/support/statusBar.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const statusBarWorking = (
55
dismissAfter: number = 2000,
66
) => {
77
vscode.window.setStatusBarMessage(
8-
`$(loading~spin) ${message}...`,
8+
`$(loading~spin) ${message}`,
99
dismissAfter,
1010
);
1111
};
@@ -14,12 +14,12 @@ export const statusBarSuccess = (
1414
message: string,
1515
dismissAfter: number = 3000,
1616
) => {
17-
vscode.window.setStatusBarMessage(`$(check) ${message}...`, dismissAfter);
17+
vscode.window.setStatusBarMessage(`$(check) ${message}`, dismissAfter);
1818
};
1919

2020
export const statusBarError = (
2121
message: string,
2222
dismissAfter: number = 3000,
2323
) => {
24-
vscode.window.setStatusBarMessage(`$(error) ${message}...`, dismissAfter);
24+
vscode.window.setStatusBarMessage(`$(error) ${message}`, dismissAfter);
2525
};

0 commit comments

Comments
 (0)