Skip to content

Commit 8fed401

Browse files
Merge pull request intersystems-community#1173 from gjsjohnmurray/coral-kingfisher
Support a ${username} variable in Server Actions Menu custom entries
2 parents 978dcff + f82f408 commit 8fed401

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

docs/Configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ You can add custom entries to this list using the `objectscript.conn.links` conf
239239
- **${serverUrl}** - The full connection string for the server. For example, `http://localhost:52773/pathPrefix`
240240
- **${ns}** - The namespace that we are connected to, URL encoded. For example, `%25SYS` or `USER`
241241
- **${namespace}** - The raw `ns` parameter of the connection. For example, `sys` or `user`
242+
- **${username}** - The username you are connected as.
242243
- **${classname}** - The name of the currently opened class, or the empty string if the currently opened document is not a class.
243244
- **${classnameEncoded}** - URL encoded version of **\${classname}**.
244245
- **${project}** - The currently opened server-side project, or the empty string.

src/commands/serverActions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type ServerAction = { detail: string; id: string; label: string; rawLink?: strin
2323
export async function serverActions(): Promise<void> {
2424
const { apiTarget, configName: workspaceFolder } = connectionTarget();
2525
const api = new AtelierAPI(apiTarget);
26-
const { active, host = "", ns = "", https, port = 0, pathPrefix, docker } = api.config;
26+
const { active, host = "", ns = "", https, port = 0, pathPrefix, username, docker } = api.config;
2727
const explorerCount = (await explorerProvider.getChildren()).length;
2828
if (!explorerCount && (!docker || host === "")) {
2929
await vscode.commands.executeCommand("ObjectScriptExplorer.focus");
@@ -156,6 +156,7 @@ export async function serverActions(): Promise<void> {
156156
.replace("${serverAuth}", "")
157157
.replace("${ns}", nsEncoded)
158158
.replace("${namespace}", ns == "%SYS" ? "sys" : nsEncoded.toLowerCase())
159+
.replace("${username}", username)
159160
.replace("${classname}", classname)
160161
.replace("${classnameEncoded}", classnameEncoded)
161162
.replace("${project}", project);

0 commit comments

Comments
 (0)