You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by sh...@apache.org on 2023/04/18 14:06:40 UTC
[daffodil-vscode] branch main updated: omega-edit client get specified port from launch.json
This is an automated email from the ASF dual-hosted git repository.
shanedell pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil-vscode.git
The following commit(s) were added to refs/heads/main by this push:
new d285cc1 omega-edit client get specified port from launch.json
d285cc1 is described below
commit d285cc194851608d6d888b6a6790da0030cde988
Author: Shane Dell <sh...@gmail.com>
AuthorDate: Thu Apr 13 15:07:18 2023 -0400
omega-edit client get specified port from launch.json
- Updated the omega-edit client to loop through all configuartions inside of launch.json.
- If dataEditor.omegaEdit is set the omegaEditPort variable will be updated.
- If multiple configurations set dataEditor.omegaEdit the last one to set it is the value used.
Closes #579
---
src/dataEdit/client.ts | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/src/dataEdit/client.ts b/src/dataEdit/client.ts
index b4480c6..17a574c 100644
--- a/src/dataEdit/client.ts
+++ b/src/dataEdit/client.ts
@@ -80,9 +80,29 @@ function getPidFile(serverPort: number) {
async function getOmegaEditPort() {
if (omegaEditPort === 0) {
- omegaEditPort = vscode.workspace
- .getConfiguration('dataEditor')
- .get<number>('omegaEditPort', DEFAULT_OMEGA_EDIT_PORT)
+ /**
+ * Loop through all available configurations inside of launch.json
+ * If dataEditor.omegaEditPort is set then we update the port
+ * NOTE: Whichever configuration sets the last will be the value used
+ */
+ vscode.workspace
+ .getConfiguration(
+ 'launch',
+ vscode.workspace.workspaceFolders
+ ? vscode.workspace.workspaceFolders[0].uri
+ : vscode.Uri.parse('')
+ )
+ .get<Array<Object>>('configurations')
+ ?.forEach((config) => {
+ omegaEditPort =
+ 'dataEditor.omegaEditPort' in config
+ ? (config['dataEditor.omegaEditPort'] as number)
+ : omegaEditPort
+ })
+
+ omegaEditPort =
+ omegaEditPort !== 0 ? omegaEditPort : DEFAULT_OMEGA_EDIT_PORT
+
if (
omegaEditPort <= OMEGA_EDIT_MIN_PORT ||
omegaEditPort > OMEGA_EDIT_MAX_PORT