-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix HTML/YML server crash issue (#988)
- Loading branch information
1 parent
960aa93
commit 090bdf7
Showing
6 changed files
with
47 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
import { | ||
WorkspaceFolder | ||
} from 'vscode-languageserver/node'; | ||
import { glob } from 'glob'; | ||
import { sendTelemetryEvent } from "../../client/power-pages/telemetry"; | ||
import { ITelemetry } from "../../client/telemetry/ITelemetry"; | ||
|
||
export function getPortalsOrgURLs(workspaceRootFolders: WorkspaceFolder[] | null, telemetry: ITelemetry) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
let output: any[] = []; | ||
try { | ||
workspaceRootFolders?.forEach(workspaceRootFolder => { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const manifestFiles = glob.sync('**/*-manifest.yml', { dot: true, cwd: workspaceRootFolder!.uri }); | ||
if (manifestFiles.length == 0) { | ||
output = [{ | ||
orgURL: '', | ||
isManifestExists: false | ||
}]; | ||
} else { | ||
manifestFiles?.forEach(manifestFile => { | ||
output.push({ | ||
orgURL: manifestFile.split("-manifest")[0].replace(/.*[portalconfig]\//, ''), | ||
isManifestExists: true | ||
}); | ||
}) | ||
} | ||
}); | ||
} catch (exception) { | ||
sendTelemetryEvent(telemetry, { methodName: getPortalsOrgURLs.name, eventName: 'getPortalsOrgURLs', exception: exception as Error }); | ||
} | ||
return output; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters