Skip to content

Commit

Permalink
Merge pull request #2612 from BetterThanTomorrow/2606-connect-sequenc…
Browse files Browse the repository at this point in the history
…es-preferences-priority

Sort connect sequence configuration sources User last

* Fixes #2606
  • Loading branch information
PEZ authored Sep 3, 2024
2 parents 73531ef + 91a81e2 commit 99f887a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Changes to Calva.
## [Unreleased]

- Bump deps.clj to v1.11.3.1463
- [Prioritize Workspace configured connect sequences over User configured dittos](https://github.com/BetterThanTomorrow/calva/issues/2606)

## [2.0.467] - 2024-07-14

Expand Down
7 changes: 7 additions & 0 deletions docs/site/connect-sequences.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ A connect sequence configures the following:

The [Calva built-in sequences](https://github.com/BetterThanTomorrow/calva/blob/published/src/nrepl/connectSequence.ts) also use this format, check them out to get a clearer picture of how these settings work.

!!! Note "How sequence configurations are merged"
The sequence configuration, `calva.replConnectSequences` is an array and the sequences in the array will be listed and processed in the order they appear. However, you can configure connect sequences in several places, even if they make most sense on the Workspace level. The configurations are merged in the following order:

1. Workspace Folder settings
1. Workspace settings
1. User settings

!!! Note "Force the project type menu to show"
The convenience of `autoSelectForJackIn/Connect` can be an inconvenience when you want to use another project type/sequence for a project. For this reason, the `calva.connect` and `calva.jackIn` can be provided with an option `disableAutoSelect`, which forces the project root and project type menus to show. See [Options for the Connect Command](connect.md#options-for-the-jack-in-command) and [Options for the Jack-in Command](connect.md#options-for-the-connect-command) for more on this.

Expand Down
4 changes: 2 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ function getConfig() {
const replConnectSequencesConfig =
configOptions.inspect<ReplConnectSequence[]>('replConnectSequences');
const replConnectSequences = [
...(replConnectSequencesConfig.globalValue ?? []),
...(replConnectSequencesConfig.workspaceValue ?? []),
...(replConnectSequencesConfig.workspaceFolderValue ?? []),
...(replConnectSequencesConfig.workspaceValue ?? []),
...(replConnectSequencesConfig.globalValue ?? []),
].map((sequence) => {
if (Array.isArray(sequence.afterCLJReplJackInCode)) {
return {
Expand Down
1 change: 1 addition & 0 deletions test-data/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"projectType": "deps.edn",
"projectRootPath": ["projects/pirate-lang"],
"afterCLJReplJackInCode": ["(require 'repl)", "(println 1)", "(println 2)"],
// "autoSelectForJackIn": true,
"cljsType": "none",
"menuSelections": {
"cljAliases": ["dev", "test"]
Expand Down

0 comments on commit 99f887a

Please sign in to comment.