Fork me on GitHub
#clj-kondo
<
2022-04-26
>
jacob.maine21:04:19

Is it possible to turn off analysis of :var-usages? If not, and that feature were added, could I expect it to speed up analysis? That is, if analysis were limited to :namespace-definitions, :namespace-usages, and :var-definitions, would it be much faster, or is analysis more dominated by other things like parsing the file?

borkdude21:04:32

@jacob.maine You could test that by manually disabling. I expect it not to matter much

borkdude21:04:05

What is the context of the question, clojure-lsp?

ericdallo22:04:02

But does kondo already support disable only var-usages?

jacob.maine22:04:53

Ah, so it can already be disabled? Cool. I’ll try that. Yes, I’m asking for clojure-lsp. I’m contemplating a different startup strategy. The strategy would improve startup time in large projects and on initial load of new projects. Instead of doing a full analysis of the whole project and all its deps, we would only analyze the open files. That would work better if we could also analyze files one step away (required namespaces, or namespaces that require the open namespace), which we’d need to do an initial analysis of :namespace-definitions and :namespace-usages for. By itself, with a little bit of clever caching and on-demand analysis, that’d give us enough information to support must clojure-lsp features. There are a few more we could support if the initial analysis included :var-definitions

borkdude22:04:45

> Ah, so it can already be disabled? No I meant, testing it by disabling it manually in the code

jacob.maine22:04:21

i guess i should phrase my question slightly differently… if we could skip analysis of def and defn bodies (except to get var names, and maybe arglists and other metadata), would you expect that to speed up analysis?

borkdude22:04:12

potentially yes. there might be some unexpected interactions with hooks though, I think those should be always fully expanded first and then the bodies could be ignored after those

borkdude22:04:30

again you can try this out by manually disabling some code and see the difference

jacob.maine22:04:47

ok, thanks. i’ll try it sometime. obviously short-circuiting would omit vars defined within another defn, and other such monstrosities, but i think we could live with that.

👍 1