Clojure functions Outlined in VSCode

Is there a plugin that outlines clojure/clojurescript functions in VSCode.

** Update **
Referring to the “Outline View” in VSCode, introduced in May of 2018 https://code.visualstudio.com/updates/v1_24#_outline-view

1 Like

A snippet might be the keyword you are looking for. I found Clojure snippets by Leonardo Cardoso but I don’t use it personally. You can also create snippets yourself by following the guide. For example, you can create a defn snippet in your user snippets:

// clojure.json
{
	"defn": {
		"prefix": "defn",
		"body": [
			"(defn ${1:name}",
			"\t[${2:args}]",
			"\t$0)"
		],
		"description": "defn"
	}
}

However, I don’t know why but this snippet’s tab stop locations did not work with Calva. This might need some help from the Calva team.

What do you mean by ”outlines functions”? If you mean something that populates the Outline view, then I think the answer is no, but there is this sleeping PR to Calva that would add that, I think.

I think the tab stop locations thing could be because Calva does not detect that the editor is in snippets mode when binding the tab key for formatting purposes. I’d welcome an issue filed about it.

Another thing; That particular snippet does not play well with Calva since Calva makes VS Code automatically insert matching parens/brackets. This one works better for me:

	"defn": {
		"prefix": "(defn",
		"body": [
			"(defn ${1:name}",
			"\t[${2:args}]"
		],
		"description": "(defn …)",
	}
1 Like

OK, so I created the issue now. I marked it as good-first-issue. Just sayin’ :heart_eyes:

Thanks for the quick response @PEZ! I saw the issue is fixed now.

1 Like

It’s fixed on master. I think I might get it out in a release today as well. Otherwise, any day soon. :smile:

Now the fix is released. Please give it a try and let me know how you fare.

1 Like

It’s working well! Thanks again.

1 Like

Glad to hear!

I’m thinking that a good collection of snippets could be something that Calva provides. Either directly, or by bundling it. So, if you start to build up a collection that works for you with Calva, please remember that I am interested in such a collection. :heart: :heart_eyes:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.