Skip to content

Commit bfe7f30

Browse files
committed
Correct merge conflicts
2 parents 082cbba + fc34ba0 commit bfe7f30

File tree

4 files changed

+1512
-49
lines changed

4 files changed

+1512
-49
lines changed

packages/php-wasm/cli-util/src/lib/xdebug-path-mappings.ts

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -212,17 +212,17 @@ export function updatePhpStormConfig(
212212
},
213213
};
214214

215-
if (mappings && mappings.length) {
216-
serverElement.server![0].path_mappings = mappings.map((mapping) => ({
217-
mapping: [],
218-
':@': {
219-
'local-root': `$PROJECT_DIR$/${toPosixPath(
220-
path.relative(options.projectDir, mapping.hostPath)
221-
)}`,
222-
'remote-root': mapping.vfsPath,
223-
},
224-
}));
225-
}
215+
if (mappings && mappings.length) {
216+
serverElement.server![0].path_mappings = mappings.map((mapping) => ({
217+
mapping: [],
218+
':@': {
219+
'local-root': `$PROJECT_DIR$/${toPosixPath(
220+
path.relative(options.projectDir, mapping.hostPath)
221+
)}`,
222+
'remote-root': mapping.vfsPath,
223+
},
224+
}));
225+
}
226226

227227
// Find or create project element
228228
let projectElement = config?.find((c: PhpStormConfigNode) => !!c?.project);
@@ -408,7 +408,8 @@ export function updateVSCodeConfig(
408408

409409
// Check if configuration already exists
410410
const configurationIndex = configurationsNode?.children?.findIndex(
411-
(child: any) => JSONC.findNodeAtLocation(child, ['name'])?.value === name
411+
(child: any) =>
412+
JSONC.findNodeAtLocation(child, ['name'])?.value === name
412413
);
413414

414415
// Only add configuration if it doesn't exist
@@ -420,14 +421,14 @@ export function updateVSCodeConfig(
420421
port: 9003,
421422
};
422423

423-
if (mappings && mappings.length) {
424-
configuration.pathMappings = mappings.reduce((acc, mount) => {
425-
acc[mount.vfsPath] = `\${workspaceFolder}/${toPosixPath(
426-
path.relative(options.workspaceDir, mount.hostPath)
427-
)}`;
428-
return acc;
429-
}, {} as VSCodeConfigMetaData);
430-
}
424+
if (mappings && mappings.length) {
425+
configuration.pathMappings = mappings.reduce((acc, mount) => {
426+
acc[mount.vfsPath] = `\${workspaceFolder}/${toPosixPath(
427+
path.relative(options.workspaceDir, mount.hostPath)
428+
)}`;
429+
return acc;
430+
}, {} as VSCodeConfigMetaData);
431+
}
431432

432433
// Get the current length to append at the end
433434
const currentLength = configurationsNode?.children?.length || 0;
@@ -628,7 +629,8 @@ export async function clearXdebugIDEConfig(name: string, cwd: string) {
628629
]);
629630

630631
const configurationIndex = configurationsNode?.children?.findIndex(
631-
(child: any) => JSONC.findNodeAtLocation(child, ['name'])?.value === name
632+
(child: any) =>
633+
JSONC.findNodeAtLocation(child, ['name'])?.value === name
632634
);
633635

634636
if (configurationIndex !== undefined && configurationIndex >= 0) {

packages/php-wasm/cli-util/src/test/xdebug-path-mappings.spec.ts

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ describe('updatePhpStormConfig', () => {
9999
vfsPath: '/var/www/html/src',
100100
},
101101
],
102-
ideKey: 'PLAYGROUNDCLI',
102+
ideKey: 'PHPWASMCLI',
103103
};
104104

105105
describe('valid configurations', () => {
@@ -120,7 +120,7 @@ describe('updatePhpStormConfig', () => {
120120
</servers>
121121
</component>
122122
<component name="RunManager">
123-
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PLAYGROUNDCLI">
123+
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PHPWASMCLI">
124124
<method v="2"/>
125125
</configuration>
126126
</component>
@@ -146,7 +146,7 @@ describe('updatePhpStormConfig', () => {
146146
</servers>
147147
</component>
148148
<component name="RunManager">
149-
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PLAYGROUNDCLI">
149+
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PHPWASMCLI">
150150
<method v="2"/>
151151
</configuration>
152152
</component>
@@ -179,7 +179,7 @@ describe('updatePhpStormConfig', () => {
179179
</servers>
180180
</component>
181181
<component name="RunManager">
182-
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PLAYGROUNDCLI">
182+
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PHPWASMCLI">
183183
<method v="2"/>
184184
</configuration>
185185
</component>
@@ -205,14 +205,14 @@ describe('updatePhpStormConfig', () => {
205205
expect(configMatches.length).toBe(1);
206206
});
207207

208-
it('should handle no path mapping', () => {
208+
it('should handle no path mapping', () => {
209209
const options: PhpStormConfigOptions = {
210-
name: 'Test Server',
211-
host: 'localhost',
212-
port: 8080,
213-
projectDir: process.cwd(),
214-
ideKey: 'PLAYGROUNDCLI',
215-
};
210+
name: 'Test Server',
211+
host: 'localhost',
212+
port: 8080,
213+
projectDir: process.cwd(),
214+
ideKey: 'PHPWASMCLI',
215+
};
216216

217217
const xml =
218218
'<?xml version="1.0" encoding="UTF-8"?>\n<project version="4">\n</project>';
@@ -227,7 +227,7 @@ describe('updatePhpStormConfig', () => {
227227
</servers>
228228
</component>
229229
<component name="RunManager">
230-
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PLAYGROUNDCLI">
230+
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PHPWASMCLI">
231231
<method v="2"/>
232232
</configuration>
233233
</component>
@@ -273,7 +273,7 @@ describe('updatePhpStormConfig', () => {
273273
</servers>
274274
</component>
275275
<component name="RunManager">
276-
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PLAYGROUNDCLI">
276+
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PHPWASMCLI">
277277
<method v="2"/>
278278
</configuration>
279279
</component>
@@ -314,7 +314,7 @@ describe('updatePhpStormConfig', () => {
314314
</servers>
315315
</component>
316316
<component name="RunManager">
317-
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PLAYGROUNDCLI">
317+
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PHPWASMCLI">
318318
<method v="2"/>
319319
</configuration>
320320
</component>
@@ -355,7 +355,7 @@ describe('updatePhpStormConfig', () => {
355355
</servers>
356356
</component>
357357
<component name="RunManager">
358-
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PLAYGROUNDCLI">
358+
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PHPWASMCLI">
359359
<method v="2"/>
360360
</configuration>
361361
</component>
@@ -385,7 +385,7 @@ describe('updatePhpStormConfig', () => {
385385
</servers>
386386
</component>
387387
<component name="RunManager">
388-
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PLAYGROUNDCLI">
388+
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PHPWASMCLI">
389389
<method v="2"/>
390390
</configuration>
391391
</component>
@@ -407,7 +407,7 @@ describe('updatePhpStormConfig', () => {
407407
<project version="4">
408408
<component name="RunManager">
409409
<configuration name="Other Config" type="PHPUnitRunConfigurationType" />
410-
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PLAYGROUNDCLI">
410+
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PHPWASMCLI">
411411
<method v="2"/>
412412
</configuration>
413413
</component>
@@ -479,7 +479,7 @@ describe('updatePhpStormConfig', () => {
479479
</servers>
480480
</component>
481481
<component name="RunManager">
482-
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PLAYGROUNDCLI">
482+
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PHPWASMCLI">
483483
<method v="2"/>
484484
</configuration>
485485
</component>
@@ -545,12 +545,11 @@ describe('updatePhpStormConfig', () => {
545545
<component name="PhpServers">
546546
<servers>
547547
<server name="Test Server" host="localhost:8080" use_path_mappings="true">
548-
<path_mappings/>
549548
</server>
550549
</servers>
551550
</component>
552551
<component name="RunManager">
553-
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PLAYGROUNDCLI">
552+
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PHPWASMCLI">
554553
<method v="2"/>
555554
</configuration>
556555
</component>
@@ -583,7 +582,7 @@ describe('updatePhpStormConfig', () => {
583582
</servers>
584583
</component>
585584
<component name="RunManager">
586-
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PLAYGROUNDCLI">
585+
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PHPWASMCLI">
587586
<method v="2"/>
588587
</configuration>
589588
</component>
@@ -616,7 +615,7 @@ describe('updatePhpStormConfig', () => {
616615
</servers>
617616
</component>
618617
<component name="RunManager">
619-
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PLAYGROUNDCLI">
618+
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PHPWASMCLI">
620619
<method v="2"/>
621620
</configuration>
622621
</component>
@@ -647,7 +646,7 @@ describe('updatePhpStormConfig', () => {
647646
</servers>
648647
</component>
649648
<component name="RunManager">
650-
<configuration name="Test &amp; Server &quot;With&quot; Quotes" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test &amp; Server &quot;With&quot; Quotes" session_id="PLAYGROUNDCLI">
649+
<configuration name="Test &amp; Server &quot;With&quot; Quotes" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test &amp; Server &quot;With&quot; Quotes" session_id="PHPWASMCLI">
651650
<method v="2"/>
652651
</configuration>
653652
</component>
@@ -683,7 +682,7 @@ describe('updatePhpStormConfig', () => {
683682
</servers>
684683
</component>
685684
<component name="RunManager">
686-
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PLAYGROUNDCLI">
685+
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PHPWASMCLI">
687686
<method v="2"/>
688687
</configuration>
689688
</component>
@@ -724,7 +723,7 @@ describe('updatePhpStormConfig', () => {
724723
</servers>
725724
</component>
726725
<component name="RunManager">
727-
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PLAYGROUNDCLI">
726+
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PHPWASMCLI">
728727
<method v="2"/>
729728
</configuration>
730729
</component>
@@ -753,7 +752,7 @@ describe('updatePhpStormConfig', () => {
753752
</servers>
754753
</component>
755754
<component name="RunManager">
756-
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PLAYGROUNDCLI">
755+
<configuration name="Test Server" type="PhpRemoteDebugRunConfigurationType" factoryName="PHP Remote Debug" filter_connections="FILTER" server_name="Test Server" session_id="PHPWASMCLI">
757756
<method v="2"/>
758757
</configuration>
759758
</component>
@@ -890,8 +889,7 @@ describe('updateVSCodeConfig', () => {
890889
const options: VSCodeConfigOptions = {
891890
name: 'Test Configuration',
892891
workspaceDir: process.cwd(),
893-
}
894-
892+
};
895893

896894
const json = '{\n "configurations": []\n}';
897895
const result = updateVSCodeConfig(json, options);

0 commit comments

Comments
 (0)