New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Latest update breaks namespace > filename check #1607
Comments
/cc @svdo |
Worth mentioning that with a single segment namespace it did work correctly. |
@svdo If you want to look into it, the error happens when calling clj-kondo via this LSP server: |
@svdo @LouDnl I have a clj-kondo vsix for debugging here: I added |
Using that extension, I was able to reproduce it again on Windows and got the following
|
It looks correct in the REPL:
|
@borkdude Is the problem maybe that the return value of |
|
The code isn't running in GraalVM in this extension, but in a normal JVM |
I'll add some more logging tomorrow and then I'll publish a new plugin here |
Added more logging: |
Logs:
It seems the (let [log (fn [& strs]
(spit (io/file "clj-kondo.log") (str (str/join " " strs) "\n") :append true))
filename* (some-> filename
^String (fs/strip-ext)
(doto (log :<-:stripped))
^String (.replace "/" ".")
(doto (log :<-replaced))
(cond-> (not= fs/file-separator "/")
(-> (doto (.replace ^CharSequence fs/file-separator ".")
(log :<-replace2)))))
munged-ns (str (munge ns-name))]
(when (and filename*
(not (str/ends-with? filename* munged-ns)))
(log [:filename filename filename* filename* :ns-name ns-name :munged-ns munged-ns] :append true) |
Could it be that an extension is running inside linux in Visual Studio Code on Windows...? |
Removed conditional, always replace backslashes: |
That seems to work. Well, let's just always replace backslashes, no matter the OS, it seems a sane thing to do. |
One last time, I'm logging the file separator and OS name at startup within the extension: (info "Clj-kondo language server loaded. Please report any issues to https://github.com/borkdude/clj-kondo.")
(info "OS" (System/getProperty "os.name"))
(info "FS separator" java.io.File/separator) |
It beats me...
|
Yeah I guess that's the best you can do, good enough for me to be sure. Thanks for all the effort you have put into this thing that seemed so simple!! |
[ To keep development of this project going, consider sponsoring. If you are
already a sponsor, thank you! ]
version
v2022.3.8
platform
Windows 10
Microsoft Windows [Version 10.0.19043.1526]
editor
VSCode:
problem
Latest update that fixes the namespace bug introduces new namespace bug:
repro
Create project, create clojure file with namespace. Error occurs immediatly.
config
expected behavior
Do not give namespace / filename error
The text was updated successfully, but these errors were encountered: