clojure-lsp / clojure-lsp

Clojure & ClojureScript Language Server (LSP) implementation

Home Page:https://clojure-lsp.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding require command fails for requires without alias

blnote opened this issue · comments

Describe the bug
the code action to add a namespace results in error when it is an unqualified namespace (like tmp, user).

To Reproduce
Steps to reproduce the behavior:

  1. create namespace
(ns tmp)
(def f inc)
  1. execute code action to require from another namespace, eg for line (tmp/f 2)

Expected behavior
no error

This seems to occur only after the recent code change supporting js-requires PR

culprit seems to be a change in the add-require-suggestion function of add_missing_libspec.clj that transforms chosen-ns to a symbol (line 608). No error occurs when removing this line, but probably it was needed for the new functionality. I don't have the time to look into this in detail right now.

This happens for any code action without alias like:

Add require '[foo.bar]'