Skip to content

Commit

Permalink
handle empty workspaces and change ?? to ||
Browse files Browse the repository at this point in the history
  • Loading branch information
Cammisuli committed Nov 4, 2022
1 parent 3086ed5 commit b478ecd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions apps/nxls/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ connection.onInitialize(async (params) => {
const { workspacePath } = params.initializationOptions ?? {};
try {
WORKING_PATH =
workspacePath ??
params.rootPath ??
URI.parse(params.rootUri ?? '').fsPath ??
workspacePath ||
params.rootPath ||
URI.parse(params.rootUri ?? '').fsPath ||
params.workspaceFolders?.[0]?.uri;

if (!WORKING_PATH) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class TreeView extends BaseView {
const projectDefs = await this.cliTaskProvider.getProjects();
const map = this.groupByRootPath(projectDefs);

if (map.size === 0) {
if (map.size === 0 && Object.keys(projectDefs).length > 0) {
// An angular project has its root project dir at ''
// Therefore, the map will be empty
const [[projectName, projectDef]] = Object.entries(projectDefs);
Expand Down

0 comments on commit b478ecd

Please sign in to comment.