lsp

JR 2026-04-22T00:54:35.229439Z

I was looking at issue https://github.com/clojure-lsp/clojure-lsp/issues/1734. This complains that if the namespace keyword is missing, adding a missing require fails. I think I have a fix for the specific case in the issue, but I was also thinking of a related issue that I have. There are times when I just want to create a quick file to do some testing. This is usually in the project root or a temporary directory, or outside of the project entirely (eg in /tmp). I noticed this somewhat often, probably due to my (mis)use of clojure-lsp. 🫠 Here's what I was thinking when determining a new namespace outside of the existing source paths: 1. chop off project URI and ending. So for project-uri and file-uri we would have: "file:///home/john/Projects/clojure-lsp" "file:///home/john/Projects/clojure-lsp/mytest5.clj" => mytest5 2. if necessary, convert any directory separators into package separators and underscores to hyphens "file:///home/john/Projects/clojure-lsp" "file:///home/john/Projects/clojure-lsp/foo/mytest5.clj" => foo.mytest5 3. if the filename is outside of the project, just take the last part and hope for the best "file:///tmp/mytest5.clj" => mytest5 Are there better options?