If you're here just to see how to enable flags, check the How to add flags as a user section in the explanation below
Feature request
Add two new sections to the webview:
A button on the startpage leading to a page where global flags (sshfs.flags) can be viewed/added/changed/removed.
We might also want to give the user the choice whether to edit the "global" flags in User Settings, Workspace settings, ...
A similar section (in a collapsible div?) to the ConfigEditor, allowing the user to do the same for config-specific flags
Some notes regarding this:
The actual FlagEditor component that'll probably be created can be used in both sections
We need to (manually) add a list of flags that exist along with their descriptions
For boolean flags, allow the user to set the flag to true/false or just remove it (thus using the default)
For string flags, it can just be a simple text input field
While the extension/webview supports editing configs from the settings UI, it doesn't allow changing global User Settings
It might be good to allow the user to add any flag (with any value), although currently flags are hardcoded.
Only allowing the user to pick existing flags (and limit what type of value they can enter) is more than fine though.
Technical explanation about the flag system
The flag system got added in 83d6cd0 and expanded upon in 218188a and 9de1d03. It allows the user to quickly toggle certain features/fixes in the extension, both globally or per-config. We can also make the extension automatically enable/disable flags (yet allow it to be overridden by the user), as shown here for DF-GE that fixes #239:
How to add flags as a user
For managing flags globally, the user can edit the `sshfs.flags` setting in VS Code's User Settings. For example:
```json
"sshfs.flags": [
"DEBUG_SSH2"
],
```
For a per-config basis, the user requires to edit the JSON-representation of the config. This is usually under `sshfs.configs` in the User Settings, but could be in other places if you configured it that way, e.g. the workspace settings:
```json
"sshfs.configs": [
{
"name": "config-name",
"host": "localhost",
"flags": ["DEBUG_SSH2"]
}
],
```
Parsing of flags
Flags are case-insensitive, and are basically represented as strings, where the resulting flag value depends on the format:
```ts
"+KEY" => true
"-KEY" => false
"KEY" => null
"KEY=something" => "something"
```
Boolean flags (e.g. `DEBUG_SSH2` in 06bce85) will on top of that convert non-boolean values (e.g. `null` and `"something"`) to booleans on very simple rules:
- If the value is `null`, we return `true` (thus the presence of a (non-false) flag counts as `true`)
- If it's a string that lowercase equals `true`, `t`, `yes` or `y`, we return `true`
- If it's a string that lowercase equals `false`, `f`, `no` or `n`, we return `false`
- In other cases, we assume the user did something wrong, so we throw an error
This allows the user to simply add e.g. `DEBUG_SSH2` _(or `+DEBUG_SSH2` or `DEBUG_SSH=true` etc)_ to enable debugging of the ssh2 library, while also supporting `-CHECK_HOME` _(or `CHECK_HOME=no` etc)_ to disable that enabled-by-default flag.
List of currently available flags
https://github.com/SchoofsKelvin/vscode-sshfs/blob/87d2cf845a62d23d55bbb253b4697e2acbdf05a0/src/config.ts#L370-L384
_check up-to-date list at https://github.com/SchoofsKelvin/vscode-sshfs/blob/master/src/config.ts_
If you're here just to see how to enable flags, check the
How to add flags as a user
section in the explanation belowFeature request
Add two new sections to the webview:
sshfs.flags
) can be viewed/added/changed/removed. We might also want to give the user the choice whether to edit the "global" flags in User Settings, Workspace settings, ...Some notes regarding this:
true
/false
or just remove it (thus using the default)Technical explanation about the flag system
The flag system got added in 83d6cd0 and expanded upon in 218188a and 9de1d03. It allows the user to quickly toggle certain features/fixes in the extension, both globally or per-config. We can also make the extension automatically enable/disable flags (yet allow it to be overridden by the user), as shown here for
DF-GE
that fixes #239:Extension auto-enabling
https://github.com/SchoofsKelvin/vscode-sshfs/blob/87d2cf845a62d23d55bbb253b4697e2acbdf05a0/src/config.ts#L389-L405DF-GE
And a simple example of the extension checking a boolean flag:
Extension checking
https://github.com/SchoofsKelvin/vscode-sshfs/blob/87d2cf845a62d23d55bbb253b4697e2acbdf05a0/src/connect.ts#L266-L273DF-GE
Here's more information regarding flags:
How to add flags as a user
For managing flags globally, the user can edit the `sshfs.flags` setting in VS Code's User Settings. For example: ```json "sshfs.flags": [ "DEBUG_SSH2" ], ``` For a per-config basis, the user requires to edit the JSON-representation of the config. This is usually under `sshfs.configs` in the User Settings, but could be in other places if you configured it that way, e.g. the workspace settings: ```json "sshfs.configs": [ { "name": "config-name", "host": "localhost", "flags": ["DEBUG_SSH2"] } ], ```Parsing of flags
Flags are case-insensitive, and are basically represented as strings, where the resulting flag value depends on the format: ```ts "+KEY" => true "-KEY" => false "KEY" => null "KEY=something" => "something" ``` Boolean flags (e.g. `DEBUG_SSH2` in 06bce85) will on top of that convert non-boolean values (e.g. `null` and `"something"`) to booleans on very simple rules: - If the value is `null`, we return `true` (thus the presence of a (non-false) flag counts as `true`) - If it's a string that lowercase equals `true`, `t`, `yes` or `y`, we return `true` - If it's a string that lowercase equals `false`, `f`, `no` or `n`, we return `false` - In other cases, we assume the user did something wrong, so we throw an error This allows the user to simply add e.g. `DEBUG_SSH2` _(or `+DEBUG_SSH2` or `DEBUG_SSH=true` etc)_ to enable debugging of the ssh2 library, while also supporting `-CHECK_HOME` _(or `CHECK_HOME=no` etc)_ to disable that enabled-by-default flag.List of currently available flags
https://github.com/SchoofsKelvin/vscode-sshfs/blob/87d2cf845a62d23d55bbb253b4697e2acbdf05a0/src/config.ts#L370-L384 _check up-to-date list at https://github.com/SchoofsKelvin/vscode-sshfs/blob/master/src/config.ts_