Skip to content

Commit feda3e1

Browse files
committed
Merge branch 'master' into release
2 parents 24df5c4 + 2324c95 commit feda3e1

File tree

11 files changed

+189
-145
lines changed

11 files changed

+189
-145
lines changed

apps/nxls/src/main.ts

+41-32
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ connection.onHover(async (hoverParams) => {
223223
return await getHover(hoverParams, jsonAst, document);
224224
});
225225

226-
connection.onDefinition((definitionParams) => {
226+
connection.onDefinition(async (definitionParams) => {
227227
const definitionDocument = documents.get(definitionParams.textDocument.uri);
228228

229229
if (!definitionDocument || !WORKING_PATH) {
@@ -232,28 +232,37 @@ connection.onDefinition((definitionParams) => {
232232

233233
const { jsonAst, document } = getJsonDocument(definitionDocument);
234234

235-
return getDefinition(WORKING_PATH, definitionParams, jsonAst, document);
235+
return await getDefinition(WORKING_PATH, definitionParams, jsonAst, document);
236236
});
237237

238238
connection.onDocumentLinks(async (params) => {
239-
const linkDocument = documents.get(params.textDocument.uri);
239+
try {
240+
const linkDocument = documents.get(params.textDocument.uri);
240241

241-
if (!linkDocument) {
242-
return null;
243-
}
242+
if (!linkDocument) {
243+
return null;
244+
}
244245

245-
const { jsonAst, document } = getJsonDocument(linkDocument);
246+
const { jsonAst, document } = getJsonDocument(linkDocument);
246247

247-
const schemas = await getJsonLanguageService()?.getMatchingSchemas(
248-
document,
249-
jsonAst
250-
);
248+
const schemas = await getJsonLanguageService()?.getMatchingSchemas(
249+
document,
250+
jsonAst
251+
);
251252

252-
if (!schemas) {
253+
if (!schemas) {
254+
return;
255+
}
256+
const links = await getDocumentLinks(
257+
WORKING_PATH,
258+
jsonAst,
259+
document,
260+
schemas
261+
);
262+
return links;
263+
} catch (e) {
253264
return;
254265
}
255-
256-
return getDocumentLinks(WORKING_PATH, jsonAst, document, schemas);
257266
});
258267

259268
const jsonDocumentMapper = getLanguageModelCache();
@@ -305,7 +314,7 @@ connection.onRequest(NxWorkspaceRequest, async ({ reset }) => {
305314
return new ResponseError(1000, 'Unable to get Nx info: no workspace path');
306315
}
307316

308-
return nxWorkspace(WORKING_PATH, reset);
317+
return await nxWorkspace(WORKING_PATH, reset);
309318
});
310319

311320
connection.onRequest(NxWorkspaceSerializedRequest, async ({ reset }) => {
@@ -331,7 +340,7 @@ connection.onRequest(
331340
);
332341
}
333342

334-
return getGenerators(WORKING_PATH, args.options);
343+
return await getGenerators(WORKING_PATH, args.options);
335344
}
336345
);
337346

@@ -345,7 +354,7 @@ connection.onRequest(
345354
);
346355
}
347356

348-
return getGeneratorOptions(
357+
return await getGeneratorOptions(
349358
WORKING_PATH,
350359
args.options.collection,
351360
args.options.name,
@@ -363,7 +372,7 @@ connection.onRequest(
363372
'Unable to get Nx info: no workspace path'
364373
);
365374
}
366-
return getProjectByPath(args.projectPath, WORKING_PATH);
375+
return await getProjectByPath(args.projectPath, WORKING_PATH);
367376
}
368377
);
369378

@@ -376,7 +385,7 @@ connection.onRequest(
376385
'Unable to get Nx info: no workspace path'
377386
);
378387
}
379-
return getProjectsByPaths(args.paths, WORKING_PATH);
388+
return await getProjectsByPaths(args.paths, WORKING_PATH);
380389
}
381390
);
382391

@@ -389,7 +398,7 @@ connection.onRequest(
389398
'Unable to get Nx info: no workspace path'
390399
);
391400
}
392-
return getProjectByRoot(args.projectRoot, WORKING_PATH);
401+
return await getProjectByRoot(args.projectRoot, WORKING_PATH);
393402
}
394403
);
395404

@@ -402,7 +411,7 @@ connection.onRequest(
402411
'Unable to get Nx info: no workspace path'
403412
);
404413
}
405-
return getGeneratorContextV2(args.path, WORKING_PATH);
414+
return await getGeneratorContextV2(args.path, WORKING_PATH);
406415
}
407416
);
408417

@@ -418,7 +427,7 @@ connection.onRequest(NxProjectGraphOutputRequest, async () => {
418427
if (!WORKING_PATH) {
419428
return new ResponseError(1000, 'Unable to get Nx info: no workspace path');
420429
}
421-
return getProjectGraphOutput(WORKING_PATH);
430+
return await getProjectGraphOutput(WORKING_PATH);
422431
});
423432

424433
connection.onRequest(NxCreateProjectGraphRequest, async ({ showAffected }) => {
@@ -449,7 +458,7 @@ connection.onRequest(
449458
'Unable to get Nx info: no workspace path'
450459
);
451460
}
452-
return getTransformedGeneratorSchema(WORKING_PATH, schema);
461+
return await getTransformedGeneratorSchema(WORKING_PATH, schema);
453462
}
454463
);
455464

@@ -462,22 +471,22 @@ connection.onRequest(
462471
'Unable to get Nx info: no workspace path'
463472
);
464473
}
465-
return getStartupMessage(WORKING_PATH, schema);
474+
return await getStartupMessage(WORKING_PATH, schema);
466475
}
467476
);
468477

469478
connection.onRequest(NxHasAffectedProjectsRequest, async () => {
470479
if (!WORKING_PATH) {
471480
return new ResponseError(1000, 'Unable to get Nx info: no workspace path');
472481
}
473-
return hasAffectedProjects(WORKING_PATH, lspLogger);
482+
return await hasAffectedProjects(WORKING_PATH, lspLogger);
474483
});
475484

476485
connection.onRequest(NxSourceMapFilesToProjectsMapRequest, async () => {
477486
if (!WORKING_PATH) {
478487
return new ResponseError(1000, 'Unable to get Nx info: no workspace path');
479488
}
480-
return getSourceMapFilesToProjectsMap(WORKING_PATH);
489+
return await getSourceMapFilesToProjectsMap(WORKING_PATH);
481490
});
482491

483492
connection.onRequest(
@@ -489,7 +498,7 @@ connection.onRequest(
489498
'Unable to get Nx info: no workspace path'
490499
);
491500
}
492-
return getTargetsForConfigFile(
501+
return await getTargetsForConfigFile(
493502
args.projectName,
494503
args.configFilePath,
495504
WORKING_PATH
@@ -501,29 +510,29 @@ connection.onRequest(NxCloudStatusRequest, async () => {
501510
if (!WORKING_PATH) {
502511
return new ResponseError(1000, 'Unable to get Nx info: no workspace path');
503512
}
504-
return getNxCloudStatus(WORKING_PATH);
513+
return await getNxCloudStatus(WORKING_PATH);
505514
});
506515

507516
connection.onRequest(NxCloudOnboardingInfoRequest, async () => {
508517
if (!WORKING_PATH) {
509518
return new ResponseError(1000, 'Unable to get Nx info: no workspace path');
510519
}
511-
return getCloudOnboardingInfo(WORKING_PATH);
520+
return await getCloudOnboardingInfo(WORKING_PATH);
512521
});
513522

514523
connection.onRequest(NxPDVDataRequest, async (args: { filePath: string }) => {
515524
if (!WORKING_PATH) {
516525
return new ResponseError(1000, 'Unable to get Nx info: no workspace path');
517526
}
518-
return getPDVData(WORKING_PATH, args.filePath);
527+
return await getPDVData(WORKING_PATH, args.filePath);
519528
});
520529

521530
connection.onRequest(NxRecentCIPEDataRequest, async () => {
522531
if (!WORKING_PATH) {
523532
return new ResponseError(1000, 'Unable to get Nx info: no workspace path');
524533
}
525534

526-
return getRecentCIPEData(WORKING_PATH);
535+
return await getRecentCIPEData(WORKING_PATH);
527536
});
528537

529538
connection.onRequest(
@@ -535,7 +544,7 @@ connection.onRequest(
535544
'Unable to get Nx info: no workspace path'
536545
);
537546
}
538-
return parseTargetString(targetString, WORKING_PATH);
547+
return await parseTargetString(targetString, WORKING_PATH);
539548
}
540549
);
541550

apps/vscode/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -796,11 +796,11 @@
796796
"default": "all",
797797
"description": "Controls which notifications are shown for Nx Cloud."
798798
},
799-
"nxConsole.enableNxCopilotFeatures": {
799+
"nxConsole.debugMode": {
800800
"type": "boolean",
801801
"default": false,
802802
"scope": "machine",
803-
"description": "Enable Nx-specific copilot features (Experimental)."
803+
"description": "Enable debug mode (internal)"
804804
}
805805
}
806806
},

libs/language-server/utils/src/lib/nx-cloud.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import type { NxJsonConfiguration } from 'nx/src/devkit-exports';
33
import { lspLogger } from './lsp-log';
44

55
export async function isNxCloudUsed(workspacePath: string): Promise<boolean> {
6-
const nxJson = await readNxJson(workspacePath);
6+
let nxJson: NxJsonConfiguration;
7+
try {
8+
nxJson = await readNxJson(workspacePath);
9+
} catch (e) {
10+
return false;
11+
}
712

813
let getIsNxCloudUsed: (nxJson: NxJsonConfiguration) => boolean;
914
try {

libs/vscode/configuration/src/lib/configuration-keys.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const GLOBAL_CONFIG_KEYS = [
1414
'showNodeVersionOnStartup',
1515
'nxWorkspacePath',
1616
'nxCloudNotifications',
17-
'enableNxCopilotFeatures',
17+
'debugMode',
1818
] as const;
1919

2020
export type GlobalConfig = {
@@ -33,7 +33,7 @@ export type GlobalConfig = {
3333
showNodeVersionOnStartup: boolean;
3434
nxWorkspacePath: string;
3535
nxCloudNotifications: 'all' | 'errors' | 'none';
36-
enableNxCopilotFeatures: boolean;
36+
debugMode: boolean;
3737
};
3838

3939
/**

0 commit comments

Comments
 (0)