File tree Expand file tree Collapse file tree 4 files changed +45
-3
lines changed Expand file tree Collapse file tree 4 files changed +45
-3
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import { updateDiagnostics } from "./diagnostic/diagnostic";
16
16
import { hoverProviders } from "./hover/HoverProvider" ;
17
17
import { linkProviders } from "./link/LinkProvider" ;
18
18
import { configAffected } from "./support/config" ;
19
+ import { collectDebugInfo } from "./support/debug" ;
19
20
import { disposeWatchers } from "./support/fileWatcher" ;
20
21
import { info } from "./support/logger" ;
21
22
import { setParserBinaryPath } from "./support/parser" ;
@@ -134,6 +135,8 @@ export function activate(context: vscode.ExtensionContext) {
134
135
vscode . commands . registerCommand ( "laravel.open" , openFileCommand ) ,
135
136
) ;
136
137
138
+ collectDebugInfo ( ) ;
139
+
137
140
vscode . workspace . onDidChangeConfiguration ( ( event ) => {
138
141
if ( configAffected ( event , "phpCommand" , "phpEnvironment" ) ) {
139
142
clearDefaultPhpCommand ( ) ;
Original file line number Diff line number Diff line change
1
+ import os from "os" ;
2
+ import { getCommandTemplate , runInLaravel } from "./php" ;
3
+
4
+ export const debugInfo : Record < string , string > = { } ;
5
+
6
+ export const collectDebugInfo = ( ) => {
7
+ debugInfo [ "os" ] = os . platform ( ) ;
8
+ debugInfo [ "arch" ] = os . arch ( ) ;
9
+
10
+ runInLaravel ( `
11
+ echo json_encode([
12
+ 'php_version' => phpversion(),
13
+ 'laravel_version' => app()->version(),
14
+ ]);
15
+ ` ) . then ( ( output ) => {
16
+ if ( output ) {
17
+ for ( const key in output as Record < string , string > ) {
18
+ // @ts -ignore
19
+ debugInfo [ key ] = output [ key ] ;
20
+ }
21
+ }
22
+
23
+ debugInfo [ "php_command" ] = getCommandTemplate ( ) ;
24
+ } ) ;
25
+ } ;
Original file line number Diff line number Diff line change @@ -273,6 +273,10 @@ const getHashedFile = (code: string) => {
273
273
return fixFilePath ( hashedFile ) ;
274
274
} ;
275
275
276
+ export const getCommandTemplate = ( ) : string => {
277
+ return config < string > ( "phpCommand" , "" ) || getDefaultPhpCommand ( ) ;
278
+ } ;
279
+
276
280
export const runPhp = (
277
281
code : string ,
278
282
description : string | null = null ,
@@ -282,8 +286,7 @@ export const runPhp = (
282
286
code = "<?php\n\n" + code ;
283
287
}
284
288
285
- const commandTemplate =
286
- config < string > ( "phpCommand" , "" ) || getDefaultPhpCommand ( ) ;
289
+ const commandTemplate = getCommandTemplate ( ) ;
287
290
288
291
const hashedFile = getHashedFile ( code ) ;
289
292
Original file line number Diff line number Diff line change 1
1
import * as vscode from "vscode" ;
2
2
import { config } from "./config" ;
3
+ import { debugInfo } from "./debug" ;
3
4
import { channel , error } from "./logger" ;
4
5
5
6
let showErrorPopups = config < boolean > ( "showErrorPopups" , false ) ;
@@ -28,7 +29,17 @@ export const showErrorPopup = (...errors: string[]) => {
28
29
{
29
30
title : "Copy Error to Clipboard" ,
30
31
command : ( ) => {
31
- vscode . env . clipboard . writeText ( errors . join ( "\n" ) ) ;
32
+ const finalMessage = [
33
+ "Debug Info" ,
34
+ "" ,
35
+ JSON . stringify ( debugInfo , null , 2 ) ,
36
+ "" ,
37
+ "-" . repeat ( 40 ) ,
38
+ "" ,
39
+ ...errors ,
40
+ ] ;
41
+
42
+ vscode . env . clipboard . writeText ( finalMessage . join ( "\n" ) ) ;
32
43
} ,
33
44
} ,
34
45
{
You can’t perform that action at this time.
0 commit comments