Fork me on GitHub
#clj-kondo
<
2022-05-02
>
FABRICIO20:05:57

Hello everyone 🙂 i'm experiencing one linter problem with the extension... it is not recognizing the simbols defined inside the reagent/with-let function, so it underline every repetition of those symbols in the function... i'm in a mac Monterey. I'm using latest versions for clj-kondo, calva and vscode as well Thanks in advance for any help you could give me! something like this:

borkdude20:05:43

@fabriciocozzarolo configuration: {:lint-as {reagent.core/with-let clojure.core/let}}

borkdude20:05:10

Perhaps this configuration could be automatically exported by reagent - is there anyone who is maintaining it, in this channel?

FABRICIO20:05:13

that is already in the config file of the .clj-kondo folder in the project... is there another place where i should put it?

borkdude20:05:15

No, that should be it. Can you post the config in a gist or so? I suspect there is something wrong there

FABRICIO21:05:35

{:lint-as {reagent.core/with-let    clojure.core/let
           devcards.core/defcard-rg clojure.test/deftest}
 :linters
 {:unused-namespace {:level :error
                     :exclude [day8.re-frame.async-flow-fx]}
  :unresolved-var {:exclude [honeysql.helpers
                             honeysql-postgres.helpers
                             honeysql.core]}
  :consistent-alias
  {:level   :error
   :aliases {backend.app.controller-behaviors.login login-behaviour
             backend.app.models.common              mc
             backend.app.views.common               views
             clojure.string                         str
             framework.components.session.backend   session-backend
             frontend.components.actions-panel      action-panels
             frontend.components.autocomplete       auto
             frontend.components.buttons            buttons
             frontend.components.icons              icons
             frontend.components.toggles            toggles
             frontend.routing.core                  routing
             honeysql.core                          sql
             honeysql.helpers                       sqlh
             malli.core                             m
             malli.error                            me
             malli.util                             mu
             re-frame.core                          rf
             reagent.core                           r
             reagent.dom                            rdom}}}}

borkdude21:05:12

That looks good. What does the namespace form in your code look like?

FABRICIO21:05:16

(ns frontend.pages.assignments.components.positions.view
  (:require
    ["@heroicons/react/solid" :as heroicons]
    ["react-select" :as rs]
    ["react-select/creatable" :as rsc]
    [clojure.string :as str]
    [frontend.components.candidate-name-link :as cn]
    [frontend.components.dropdown-menu :as dropdown-menu]
    [frontend.components.expander-collapser :as ec]
    [frontend.components.expertise :as exp-icon]
    [frontend.components.icons :as icons]
    [frontend.events.delete-modals :as delete-modal-events]
    [frontend.events.positions :as positions-events]
    [frontend.events.team-assignments :as assignment-events]
    [frontend.events.teams :as teams-events]
    [frontend.pages.assignments.components.note :as note]
    [frontend.pages.assignments.components.positions.events :as events]
    [frontend.pages.assignments.components.positions.subs :as subs]
    [frontend.pages.assignments.defines :as defines]
    [frontend.pages.assignments.subs :as assignment-view-subs]
    [frontend.subs.expertises :as expertises-subs]
    [frontend.subs.positions :as positions-subs]
    [frontend.subs.team-assignments :as assignments-subs]
    [malli.core :as m]
    [malli.error :as me]
    [malli.util :as mu]
    [re-frame.core :as rf]
    [reagent.core :as r]
    [shared.specs.frankie-domain :as fd]
    [shared.time :as time]))

FABRICIO21:05:18

i tried to disable kondo and let calva use it but it didin't work either

borkdude21:05:37

This also looks good. Can you make a reproduction repo?

FABRICIO21:05:55

do you mean to create github repo and share the project as it is?

borkdude21:05:22

Then I can clone it and try it locally tomorrow. Well, not as is, unless it's already open source, but some project which demonstrates the same error

borkdude21:05:38

Also try linting on the command line and see if that also exhibits the error

borkdude21:05:51

with the clj-kondo binary.

FABRICIO21:05:52

yeah because i dont know if i can share it.... i will try to reproduce in another one and let you know... thank you very much 🙂

FABRICIO21:05:05

~/Desktop/clojure/Frankie/src/frontend/pages/assignments/components> clj-kondo --lint positions
positions/events.cljs:1:5: error: Namespace name does not match file name: frontend.pages.assignments.components.positions.events
positions/subs.cljs:1:5: error: Namespace name does not match file name: frontend.pages.assignments.components.positions.subs
positions/view.cljs:1:5: error: Namespace name does not match file name: frontend.pages.assignments.components.positions.view
linting took 339ms, errors: 3, warnings: 0

FABRICIO21:05:50

i get this when i try to lint the folder containing the file

borkdude21:05:48

so, no errors about reagent, right?

borkdude21:05:08

then this probably has to do with how you open the project in Calva.

borkdude21:05:32

make sure you open the project in the root folder and the config directory is also in the root folder, in .clj-kondo/config.edn

ericdallo21:05:30

yeah, sounds like wrong project root, maybe check server logs may help: https://clojure-lsp.io/troubleshooting/

FABRICIO21:05:54

what do you mean with how i open the project in calva?:thinking_face: .clj-kondo folder is in the root folder of the project.... nothing changed there since las 3 months

ericdallo21:05:11

clojure-lsp used by calva uses the project root that vscode sets, which is the project opened root

FABRICIO21:05:24

is there a special way of opening a project in vscode? y always add the project folder from the explorer to the workspace.... where can i see or modify that root folder you're saying vscode sets?

ericdallo21:05:14

if you code my-project-root should be enough, just open your project root as a folder

ericdallo21:05:28

you can't change that AFAIK on vscode

pez21:05:32

Adding the project folder to the workspace should work fine.

pez21:05:08

@fabriciocozzarolo, if it works with opening the project root in a window, but not when adding the project folder to the workspace, then we have a bug in Calva, I think.

ericdallo21:05:33

clojure-lsp logs would show which project root is set

pez21:05:44

Yes, the clojure-lsp button shows a menu from which you can show server info, @fabriciocozzarolo. See if the project root differs in the two scenarios.

☝ 1
FABRICIO21:05:29

yep... it worked opening from the console... and the project-root-uri is different in the 2 windows... is there a way to change it or just drop the workspace and open a new one?

pez22:05:46

In what way are the Uri's different?

pez22:05:32

Please file an issue about this, describing the project setup and your workspace setup.

FABRICIO22:05:01

the uri was for another project in the workspace i had

FABRICIO22:05:03

i tried removing that project and a calva error appeared, i clicked on the output log but it took me nowhere

FABRICIO22:05:00

and the lisp serve felt down

pez22:05:30

Don’t you get a menu for selecting which of the projects? What version of Calva is this?

FABRICIO23:05:45

mm no... when is calva supposed to show a menu? i simply removed the project indicated in project-root-uri to see what happened and the lsp server turned off with the error

FABRICIO23:05:23

i found that when i change the folders order in the workspace the project-root-uri key changes to the project i moved to the top in the explorer and automatically restart the lsp server

FABRICIO23:05:43

and when i move this "Frankie" project (my main project) to the top of the explorer all the linter errors disappear....

FABRICIO23:05:59

that behavior wasn't like that before, because i always had at the top a folder with annotations that i use always in all the workspaces i have

pez05:05:08

Yes, these things have changed in Calva. Now we explicitly tell clojure-lsp where the project root is, where before it was often undefined for some cases. However, when there are multiple folders, we need a way to determine project root. With the REPL we ask the user. The issue here I think is that for clojure-lsp, we just pick the first workspace folder.

pez05:05:19

I note that the VS Code window is reloaded when project folders are reordered.

pez05:05:10

Anyway, I think we can only ask clojure-lsp to analyse one project root. In the case of multiple workspace folders that means we should probably ask the user for the project root, like we do for the REPL connection.

pez05:05:50

I wonder how other clients/servers solve this...

pez05:05:19

I created an issue to track this. https://github.com/BetterThanTomorrow/calva/issues/1706

👌 1
FABRICIO16:05:56

thanks for your time guys!