This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-31
Channels
- # aleph (12)
- # announcements (4)
- # asami (7)
- # babashka (20)
- # beginners (92)
- # calva (74)
- # clj-kondo (8)
- # cljdoc (70)
- # clojure (47)
- # clojure-dev (29)
- # clojure-europe (27)
- # clojure-nl (7)
- # clojure-norway (3)
- # clojurescript (7)
- # cursive (2)
- # datomic (1)
- # emacs (8)
- # events (5)
- # fulcro (36)
- # gratitude (4)
- # humbleui (25)
- # introduce-yourself (1)
- # lsp (26)
- # malli (6)
- # missionary (8)
- # nbb (50)
- # off-topic (9)
- # pathom (2)
- # pedestal (3)
- # portal (32)
- # practicalli (5)
- # reitit (5)
- # releases (1)
- # ring (6)
- # shadow-cljs (87)
- # sql (31)
- # tools-deps (26)
- # vim (3)
- # xtdb (15)
I picked up the habit of putting a comma at the end of a comment block to preserve new lines and prevent closing parenthesis from sticking to the forms inside:
(comment
(some stuff)
,)
However, if I press tab in calva to reformat, everything reformats and comma is deleted and it becomes this:
(comment
(some stuff)
)
Anyone encountered this? How to prevent this?This happens with some auto-formatters. Some will even remove the comma and clean up the )
by moving it up to the previous a line. I've gotten used to doing this:
(comment
(some stuff)
#__)
So far no auto-formatter I've come across in any editor has messed with it. :)Notice the second _
is not magic, it could be anything that is commented via #_
, but I like the visual look :)
What is it that you want to prevent, the deletion of the comma? Calva used to (maybe a year ago? maybe longer?) pull that trailing paren up to the line above, which I didn’t like at all. The fact that it now keeps the paren on its own line is good.
The problem for me was that the dangling paren was cleaned up by some linters and autoformatters. When working on a team where people use different tools and editors, I've gotten used to just ending my rich comment forms with #__)
to avoid any editor accidentally creating change diffs when saving files.
@UTFAPNRPT Yes, I remember Calva deleting the line and pulling the paren above. It no longer seems to do it. But I don't like it deleting the comma - perhaps Now it's not much of an issue because the line doesn't get deleted.
Using the ignore tag is the safest here if working within a team. Someone is bound to use some tool deleting those commas. Like cljfmt, which is what Calva is using. I don’t think it offers a way to keep them.
@U0ETXRFEW Ignore tag seems fine, only gripe is it's 3 keystrokes instead of 1 😄
Maybe go all in and model some of the other languages with start/end symmetry:
#_commment)
#_endcomment)
#_tnemmoc)
;; or maybe docstrings, if it's a big block:
(comment "2k lines of rambling"
,,
,,
#_"2k lines of rambling")
😅I like that one! It is nice when searching the code base as well. :rcf
I might use instead.
This snippet does it. Maybe we should include that in Calva...
"RCF": {
"prefix": "(rcf",
"body": [
"(comment",
" $0",
" :rcf"
],
"description": "RCF"
}
This has an interesting side-effect, that if someone accidentally evaluates the entire comment (vs something inside the comment), they will see :rcf
and not nil
-> and may realize quicker that is probably not what they wanted to do.
It's not easy to evaluate everything inside a (commen ..)
, though? Is that something people do?
Dear Calva friends: https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.313 • https://github.com/BetterThanTomorrow/calva/issues/1924 • Fix: https://github.com/BetterThanTomorrow/calva/issues/1927 If you find anything funny with the formatting done after Paredit edit commands are performed, please report.
👋 Hello When I use Calva without a REPL connected, showing references of a function works totally fine. However, as soon as I connect to the repl, it doesn't work anymore. I have no idea how to fix it, any suggestions?
Hi! This means you don’t have the nrepl dependencies properly working. How are you starting the repl?
I have been having the same issue using: Calva: Connect to a Running REPL Server in the Project How would one debug the nrepl dependencies?
When Calva starts it outputs the configured nrepl dependencies in the Calva says Output channel. These are the ones your project needs. (Piggieback only needed for ClojureScript, so don't add that in a Clojure-only project).
Calva has a command for copying the command line it would use if it was to start the REPL for you. Calva Copy Jack-in Command to Clipboard. So that's one way to get your REPL started with the needed dependencies. Otherwise your user config or the project config are places to configure this.
Okay so looking through the deps the only one not in my project.clj was piggieback. Adding it doesn't seem to resolve the issue.
Is there any nuance when connecting to a repl running from an uberjar? (jumping through a portforward of the nrepl port)
The definitions will navigate to the correct ns but the file presented is empty.
Another similar but distinct issue is when using:
Go to Definition
I am able to navigate to the definition from a callsite.
I am also able to navigate to a callsite from the definition using the same action.
After connection to the repl. the first remains true but the second changes.
What happens is that instead of allowing you to peek the function calls, it pulls your cursor to the front of the form.
If you press the action again then it takes you to the definiton of def (Which makes sense considering where the cursor is.)
It might be important to note that the inverse action
Go to References
Still works as one would expect.
And to be specific issue 1 occurs on uberjar repl
While issue 2 occurs lein run
repl.
I'm not in-the-know about how to make it work with the uberjar REPL. If the REPL seems to be otherwise working, you can try change the default definition priority, calva.definitionProviderPriority
to prefer lsp over nrepl for lookups.
Piggieback only comes into play with ClojureScript repls. So be sure to test that particular dependency with ClojureScript.
> it pulls your cursor to the front of the form This sounds very strange. Maybe you have some keyboard shortcut bound to two actions? Try using the command palette and see what the actual commands do.
So there are no other actions with the action that I use. My working suspicion is that in trying to "Go to Definition" It takes you to the definition and puts you at the start of the form. It just so happens that you are already at the definition and so the apparent result is that it just pulls the cursor forward. I will try change the priority now and see if that would be a reasonable workaround.
Setting the following:
"calva.definitionProviderPriority":[
"lsp",
"repl"
]
Solved both of my problems. @U0ETXRFEW You are a legend, thanks for the patience and help :dancer:Cool. Please note that you might have an nrepl dependency problem still just not visible that way.
@U0ETXRFEW I am running into the same issue in all the following cases:
• Running the build-in calva jack-in command
• Running the copy-paste jack-in command and running it from terminal, then connect by running the calva.connect command
Setting calva.definitionProviderPriority
to ["lsp", "repl"]
has no effect. In fact, weirdly, when trying to set this from the settings interface it gets immediately set back to repl, lsp
in the interface when I click off the field. Setting it in the JSON settings file has no effect on the behaviour.
This feels like a bug? Any assistance would be greatly appreciated.
This is a hard blocker for using Calva for me.
@U04HKE0BTC5, what kind of project are you working with? (lein/deps/shadow-cljs/etc).
Here you can see how in the interface it is still showing repl, lsp
but in settings it is set correctly
This is a deps project
Yes, I translated the “copy jack-in command” into a home-dir alias that looks like:
❯ cat ~/.clojure/deps.edn
{:aliases {:nrepl {:extra-deps {nrepl/nrepl {:mvn/version "1.0.0"}
cider/cider-nrepl {:mvn/version "0.28.5"}}
:main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]}}}
And then I run the repl with clojure -A:nrepl
Followed by running the calva.connect
remote connection
But the issue is the same even if I use calva’s build-in jack-in
Correct. LSP seems to work properly
A before and after connection
How do I check? Would workspace settings be in a .vscode
project folder? I don’t have any such settings
For now I have the following:
{:deps {funcool/promesa {:mvn/version "10.0.594"}}}
But it is the same even with empty mapOh, nrepl deps specifically? No, the only nrepl deps are the ones used from my alias in my previous message
It does the same issue even without promesa
OK. So even with an empty deps map you have the problem. Does it work with a minimal new deps project, with only an {}
deps.edn and some minimal src/hello.cljs
file?
Something like this? Still not working
(I did restart repl)
❯ clojure --version
Clojure CLI version 1.11.1.1208
Hmm, how do I do that?
same issue
Macos Ventura 13.1 on mac M1
VSCode:
Version: 1.74.2 (Universal)
Commit: e8a3071ea4344d9d48ef8a4df2c097372b0c5161
Date: 2022-12-20T10:26:09.430Z (2 wks ago)
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin arm64 22.2.0
Sandboxed: No
Calva: v2.0.322
(I think)
The latest calva version
Hmmm, everything is about exactly the same as I have... I have an older clojure CLI, that's all.
Java
❯ java --version
openjdk 19.0.1 2022-10-18
OpenJDK Runtime Environment Temurin-19.0.1+10 (build 19.0.1+10)
OpenJDK 64-Bit Server VM Temurin-19.0.1+10 (build 19.0.1+10, mixed mode)
% java -version
openjdk version "18.0.2.1" 2022-08-18
OpenJDK Runtime Environment Zulu18.32+13-CA (build 18.0.2.1+1)
OpenJDK 64-Bit Server VM Zulu18.32+13-CA (build 18.0.2.1+1, mixed mode, sharing)
Full settings dump:
{
// EDITOR
"workbench.editor.focusRecentEditorAfterClose": false,
"security.workspace.trust.enabled": false,
"security.workspace.trust.untrustedFiles": "open",
"window.dialogStyle": "custom",
"workbench.editor.showTabs": false,
"explorer.autoReveal": false,
"workbench.settings.editor": "json",
"editor.tabSize": 2,
"editor.cursorStyle": "block",
"editor.minimap.enabled": false,
"explorer.openEditors.visible": 0,
"files.autoSave": "onFocusChange",
"editor.fontFamily": "'Operator Mono'",
"editor.fontSize": 13,
"editor.tabCompletion": "onlySnippets",
"workbench.activityBar.visible": false,
"extensions.autoUpdate": false,
"window.zoomLevel": 0,
"explorer.confirmDragAndDrop": false,
"explorer.confirmDelete": false,
"git.mergeEditor": true,
"workbench.preferredDarkColorTheme": "Gruvbox Dark",
"workbench.preferredLightColorTheme": "Gruvbox Light",
"editor.autoClosingDelete": "always",
"workbench.list.openMode": "doubleClick",
"workbench.tree.expandMode": "doubleClick",
"workbench.panel.opensMaximized": "never",
"sync.forceDownload": false,
"editor.detectIndentation": false,
"update.showReleaseNotes": false,
"window.newWindowDimensions": "maximized",
"editor.cursorBlinking": "solid",
"editor.lightbulb.enabled": false,
"editor.inlayHints.enabled": "off",
"editor.selectionHighlight": false,
"editor.lineHeight": 1.6,
"breadcrumbs.enabled": false,
"editor.folding": false,
"editor.glyphMargin": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"workbench.editor.untitled.hint": "hidden",
"explorer.compactFolders": false,
"search.quickOpen.includeHistory": false,
"editor.copyWithSyntaxHighlighting": false,
"editor.emptySelectionClipboard": false,
"editor.linkedEditing": true,
"editor.renderLineHighlight": "all",
"editor.find.seedSearchStringFromSelection": "selection",
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"workbench.startupEditor": "none",
"extensions.closeExtensionDetailsOnViewChange": true,
"extensions.ignoreRecommendations": true,
"problems.showCurrentInStatus": true,
"workbench.editorAssociations": {
"git-rebase-todo": "default"
},
"editor.guides.indentation": false,
"editor.bracketPairColorization.enabled": false,
"workbench.colorTheme": "Gruvbox Light",
"workbench.iconTheme": "file-icons",
"extensions.experimental.affinity": {
"vscodevim.vim": 1,
"eamodio.gitlens": 2,
"esbenp.prettier-vscode": 2,
"streetsidesoftware.code-spell-checker": 2,
"betterthantomorrow.calva": 2
},
"terminal.explorerKind": "external",
// "window.autoDetectColorScheme": true,
// INTELLISENSE
"editor.suggestSelection": "first",
"editor.acceptSuggestionOnCommitCharacter": false,
"editor.suggest.localityBonus": true,
"editor.wordBasedSuggestions": false,
"editor.parameterHints.enabled": false,
"editor.snippetSuggestions": "inline",
"typescript.suggest.autoImports": true,
"typescript.preferences.autoImportFileExcludePatterns": ["**/node_modules/"],
"editor.quickSuggestions": {
"other": true,
"comments": false,
"strings": true
},
"emmet.showAbbreviationSuggestions": false,
"emmet.showSuggestionsAsSnippets": false,
"emmet.showExpandedAbbreviation": "never",
// === Go-To
"editor.gotoLocation.multipleReferences": "goto",
"editor.gotoLocation.multipleImplementations": "goto",
"editor.gotoLocation.multipleDeclarations": "goto",
"editor.gotoLocation.multipleDefinitions": "goto",
"editor.gotoLocation.multipleTypeDefinitions": "goto",
"editor.definitionLinkOpensInPeek": false,
// FILE ASSOCIATIONS
"files.associations": {
"Dockerfile.*": "dockerfile"
},
"files.watcherExclude": {
"**/dist/*/**": true
},
"search.exclude": {
"**/dist": true
},
// MISC
"npm.autoDetect": "off",
"npm.packageManager": "pnpm",
"redhat.telemetry.enabled": false,
"typescript.surveys.enabled": false,
"typescript.suggest.completeFunctionCalls": true,
// SETTINGS SYNC
// VIM
"vim.overrideCopy": false,
"vim.cursorStylePerMode.normal": "block",
"vim.cursorStylePerMode.insert": "line",
"vim.cursorStylePerMode.replace": "block",
"vim.statusBarColorControl": false,
"vim.visualModeKeyBindings": [
{
"before": ["$"],
"after": ["g", "_"]
}
],
"vim.normalModeKeyBindings": [
{
"before": ["f"],
"after": ["<leader>", "<leader>", "s"]
},
{
"before": ["F"],
"after": ["<leader>", "<leader>", "f"]
},
{
"before": ["<leader>", "<leader>", "g"],
"commands": ["typescript.goToSourceDefinition"]
},
{
"before": ["<leader>", "b"],
"commands": ["paredit.barfSexpForward"]
},
{
"before": ["<leader>", "s"],
"commands": ["paredit.slurpSexpForward"]
},
{
"before": ["<leader>", "g"],
"commands": ["editor.action.goToImplementation"]
},
{
"before": ["<leader>", "c", "c"],
"commands": ["calva.connect"]
},
{
"before": ["<leader>", "r"],
"commands": ["paredit.raiseSexp"]
},
{
"before": ["<leader>", "t"],
"commands": ["paredit.transpose"]
},
{
"before": ["<leader>", "d"],
"commands": ["paredit.dragSexprBackward"]
},
{
"before": ["<leader>", "D"],
"commands": ["paredit.dragSexprForward"]
},
{
"before": ["u"],
"commands": ["undo"]
},
{
"before": ["C-r"],
"commands": ["redo"]
}
],
"vim.visualModeKeyBindingsNonRecursive": [
{
"before": ["p"],
"after": ["p", "g", "v", "y"]
}
],
"vim.hlsearch": true,
"vim.easymotion": true,
"vim.sneak": true,
// JS/TS
"javascript.updateImportsOnFileMove.enabled": "always",
"debug.javascript.codelens.npmScripts": "never",
"typescript.updateImportsOnFileMove.enabled": "always",
"typescript.disableAutomaticTypeAcquisition": true,
"javascript.suggest.completeJSDocs": false,
"typescript.suggest.completeJSDocs": false,
// CLOJURE
"calva.showCalvaSaysOnStart": false,
"[clojure]": {
"editor.defaultFormatter": "betterthantomorrow.calva"
// "editor.formatOnType": true,
// "editor.autoIndent": "full"
},
"calva.highlight.enableBracketColors": false,
"calva.highlight.rainbowIndentGuides": false,
"calva.highlight.highlightActiveIndent": false,
"calva.keybindingsEnabled": false,
"calva.definitionProviderPriority": ["lsp", "repl"],
// Calva seems to change vs-codes' definition of a word boundary, which is what is used by default by vim
"vim.iskeyword": "/\\()\"':,.;<>~!@#$%^&*|+=[]{}`?-",
"calva.replConnectSequences": [
{
"name": "clojure",
"projectType": "deps.edn",
"cljsType": "none"
}
],
// GIT LENSE
"gitlens.hovers.currentLine.over": "line",
"gitlens.hovers.annotations.changes": false,
"gitlens.currentLine.enabled": false,
"gitlens.codeLens.enabled": false,
"gitlens.statusBar.pullRequests.enabled": false,
"gitlens.hovers.pullRequests.enabled": false,
"gitlens.hovers.avatars": false,
"gitlens.hovers.currentLine.details": false,
"gitlens.hovers.annotations.enabled": false,
"gitlens.hovers.enabled": false,
"gitlens.views.commits.pullRequests.enabled": false,
"gitlens.views.commits.avatars": false,
"gitlens.views.fileHistory.avatars": false,
"gitlens.blame.avatars": false,
"gitlens.views.lineHistory.avatars": false,
"gitlens.views.branches.avatars": false,
"gitlens.views.branches.pullRequests.enabled": false,
"gitlens.views.remotes.avatars": false,
"gitlens.views.remotes.pullRequests.enabled": false,
"gitlens.views.tags.avatars": false,
"gitlens.views.worktrees.avatars": false,
"gitlens.views.worktrees.pullRequests.enabled": false,
"gitlens.views.contributors.avatars": false,
"gitlens.views.contributors.pullRequests.enabled": false,
"gitlens.views.searchAndCompare.avatars": false,
"gitlens.views.searchAndCompare.pullRequests.enabled": false,
"gitlens.blame.toggleMode": "window",
"gitlens.blame.heatmap.enabled": false,
"gitlens.blame.highlight.locations": ["gutter", "line", "overview"],
"gitlens.changes.locations": ["overview", "gutter"],
"gitlens.menus": false,
"gitlens.mode.statusBar.enabled": false,
// LIVE SHARE
"liveshare.featureSet": "stable",
"liveshare.codeLens": false,
// CPP
"[cpp]": {
"editor.defaultFormatter": "ms-vscode.cpptools"
},
"C_Cpp.default.browse.limitSymbolsToIncludedHeaders": true,
"C_Cpp.default.includePath": ["~/.platformio/packages/**"],
// MISC
"cSpell.userWords": ["Deserialization", "kubernetes", "typeof"],
"cSpell.language": "en,en-GB",
"[go]": {
"editor.defaultFormatter": "golang.go"
},
"ruby.useBundler": true,
"ruby.useLanguageServer": true,
"ruby.lint": {
"reek": false,
"rubocop": {
"useBundler": true,
"lint": false
}
},
"ruby.format": "rubocop",
"[ruby]": {
"editor.defaultFormatter": "rebornix.ruby"
},
"rust-client.engine": "rls",
"rust.show_warnings": false,
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer"
},
"[json]": {
"editor.quickSuggestions": {
"strings": true
},
"editor.suggest.insertMode": "replace",
"gitlens.codeLens.scopes": ["document"]
},
"githubPullRequests.pullBranch": "never",
"editor.wordSeparators": "/\\()\"':,.;<>~!@#$%^&*|+=[]{}`?-"
}
(sorry) :P
I opened a huddle in the channel. If you wanna join and we can screen share and see if we can figure it out that way?
2 seconds