Community Packages

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#74483 - [code] Add code-flags.conf support

Attached to Project: Community Packages
Opened by Aviana Cruz (AvianaCruz) - Sunday, 17 April 2022, 05:58 GMT
Last edited by Massimiliano Torromeo (mtorromeo) - Friday, 09 September 2022, 22:43 GMT
Task Type Feature Request
Category Packages
Status Closed
Assigned To Massimiliano Torromeo (mtorromeo)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:
As the startup script not reads code-flags.conf currently, setting flags in code-flags.conf does't have any effects.
Replacing the startup script with these lines from https://aur.archlinux.org/cgit/aur.git/tree/visual-studio-code-bin.sh?h=visual-studio-code-bin works.

```
#!/bin/bash

XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-~/.config}

# Allow users to override command-line options
if [[ -f $XDG_CONFIG_HOME/code-flags.conf ]]; then
CODE_USER_FLAGS="$(sed 's/#.*//' $XDG_CONFIG_HOME/code-flags.conf)"
fi

# don't edit the electron binary name here! simply change the variable in the PKGBUILD and we will sed it into the correct one :)
ELECTRON_RUN_AS_NODE=1 exec electron17 /usr/lib/code/out/cli.js /usr/lib/code/code.js $CODE_USER_FLAGS "$@"
```

Additional info:
https://wiki.archlinux.org/title/Visual_Studio_Code#Running_natively_under_Wayland
This task depends upon

Closed by  Massimiliano Torromeo (mtorromeo)
Friday, 09 September 2022, 22:43 GMT
Reason for closing:  Implemented
Comment by Aviana Cruz (AvianaCruz) - Thursday, 11 August 2022, 14:34 GMT
Updated start script:
```
#!/bin/bash
set -euo pipefail
shopt -s lastpipe

if [[ -f ${XDG_CONFIG_HOME:=~/.config}/code-flags.conf ]]; then
CODE_USER_FLAGS=()
echo "$(<"$XDG_CONFIG_HOME"/code-flags.conf)" | while IFS='' read -r line; do CODE_USER_FLAGS+=("$line"); done
IFS=' ' read -r -a CODE_USER_FLAGS <<<"${CODE_USER_FLAGS[@]}"
fi

# don't edit the electron binary name here! simply change the variable in the PKGBUILD andwe will sed it into the correct one :)
ELECTRON_RUN_AS_NODE=1 exec electron18 /usr/lib/code/out/cli.js /usr/lib/code/code.js "${CODE_USER_FLAGS[@]}" "$@"
```
Comment by Aviana Cruz (AvianaCruz) - Friday, 09 September 2022, 21:58 GMT
In my opinion, the flags should also be globbed by space so that we can write a flag with its arguments in the same line. The current implemention requires me write every "array item" in a new line.
Comment by Massimiliano Torromeo (mtorromeo) - Friday, 09 September 2022, 22:43 GMT
Then you would have to escape white space somehow if that need to be part of an argument. Also, it works just like electron-flags.conf, and I don't want to make it different.

There should be nothing that you are prevented from doing by having to put each argument on a new line so, in the end, I don't see good any reason to change it.

Loading...