calva

chromalchemy 2025-06-02T17:14:07.168969Z

When i use code-rewriting power tools, or even a simple copy/paste to move a form, my vscode bookmarks break (they are trying to keep track of line number, and and often failing to do so). This seems like a basic tool that is fundamentally broken. Is there a way to keep track cherry-picked code locations that uses more semantic or dynamic tooling? What are others doing?

2025-06-05T15:49:00.623999Z

I do not know. Therefore, circumstances call for uninformed speculation: Probably the bookmarker subscribes to document-change events just as Calva's document model does. If that's so, then commands that effect small edits (however numerous) will usually be "bookmark-friendlier" than commands implemented as one giant change-of-document-text, since the bookmarker will have no idea what to do with bookmarks that were within any particular changed region. Calva's reformat commands make lots of tiny little insertions and removals, but I do not know how VS Code implements dragging selections.

2025-06-05T15:52:17.103799Z

For semantically aware "bookmarks" I sometimes enjoy a tree view that occasionally presents itself in my field of vision as an alternative to the list of files. That view, and go-to-file and go-to-definition, make it reasonably quick to find what I'm looking for.

chromalchemy 2025-06-02T17:15:03.793939Z

I am using the standard popular vscode extension. I looked for others but had the same results. I dont know what the underlying line-tracking mechanism is.

chromalchemy 2025-06-02T17:18:33.237449Z

One alternative could be to use one of the documentation libraries that can scan the codebase and generate and index html page with code links than can jump right to the local code in the ide. And maybe put medata on certain forms to gather and index of “favorites”. This sounds a bit heavyweight though. I was wondering if there was something more in-line in the editor. Maybe using the code outline functionality, or clojure-lsp, etc.

chromalchemy 2025-06-02T17:18:59.769049Z

Probably using joyride + clojure-lsp would go far. But is there any prior art?

seancorfield 2025-06-02T17:19:06.133669Z

I'm curious what you use bookmarks for? I don't think I've ever encountered anyone using them so I'm not sure what the use case would be...

chromalchemy 2025-06-02T17:25:12.901989Z

If my codebase is sprawling, and I have a related set of functions in different files, my first thought is to have a curated local index of relevant code to work from. This can reduce mental clutter, and also serve as a navigator panel to jump around. It makes sense for me for this index to be be granular on the level of forms, rather than files. Because files can be long and hard to decipher on the fly. In clojure, I can often build a new pure namespace to collect disparate things. And navigating code definitions and references definitely helps. But in non-clojure code, the classical bookmarking think feels even more helpful.

chromalchemy 2025-06-02T17:25:58.863849Z

If that cherrypicked index of forms is tight enough, the bookmarks could even be used in eval commands.

seancorfield 2025-06-02T17:26:26.921159Z

Interesting. I'll have to look at that -- we have 150k lines of Clojure (and a similar amount of JS in another repo). What extension do you use?

chromalchemy 2025-06-02T17:28:31.033999Z

https://github.com/alefragnani/vscode-bookmarks I believe this is the default popular one

chromalchemy 2025-06-02T17:31:05.747339Z

Critically the bookmarks can be named, to create a semantic index. By default the view sorts bookmarks by file, and doesn’t have different bookmark groups, which is not ideal. I want like a lightweight mini-workspace (that can span files) with custom location names that are relevant to the working context.

seancorfield 2025-06-02T17:31:25.545449Z

4.3M downloads - impressive. I'll try it out. Always looking for ways to tweak my workflow.

chromalchemy 2025-06-02T17:39:21.268549Z

In my limited testing. Commands like reformat code or slurp exp seems to trigger bookmark line number updates. But drag-sexpy-forward/backward dont.

chromalchemy 2025-06-02T17:43:40.313219Z

Vscode can produce and use code locations links like this

But again, these are not stable. It seems like line number is not the right abstraction. I wonder if there could be a thing to track the code form. It should work in comment forms and non-named code. Maybe the only solution is to lint the code to set anchors? If the code is pretty stable, this is not much of a problem.

chromalchemy 2025-06-02T17:46:51.642569Z

fyi this one gives “meta” bookmarks to collect locations by linting an @context token https://marketplace.visualstudio.com/items?itemName=tintinweb.vscode-inline-bookmarks

chromalchemy 2025-06-02T17:49:14.387479Z

This one allows one to collect and restore a group of tabs. Which servers as a kind of mini-workspace. But only works at file level. https://marketplace.visualstudio.com/items?itemName=amodio.restore-editors

pez 2025-06-02T18:30:46.846199Z

The author of that popular extension is since a while a member of the VS Code team.

wevrem 2025-06-02T19:44:22.467969Z

Centuries ago I used Panic's editor Coda, which has since been renamed and rebranded, and it had a feature where you could create a comment with a particular prefix, sort of like //MARK: and it would show up in the navigation panels, could be searched for, etc., functioning just like a bookmark. I always loved that feature to help me organize my code, and I haven't ever seen anything like it anywhere else.

chromalchemy 2025-06-02T19:48:27.948219Z

seems like the “Inline Bookmarks” extension above is supposed to do something like that. But It doesnt seem to be working for me.

pez 2025-06-03T06:00:40.424069Z

> In my limited testing. Commands like reformat code or slurp exp seems to trigger bookmark line number updates. But drag-sexpy-forward/backward dont. This is an interesting observation, I think we have some different ways we apply edits, so it could be that this matters. WDYT, @phill?