Skip to content
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

Missing requires autocompleted to ns even when require exists in the file #1306

Open
PEZ opened this issue Oct 5, 2022 · 0 comments
Open
Labels
bug Something isn't working editor Related to clojure-lsp on a text editor
Projects

Comments

@PEZ
Copy link
Contributor

PEZ commented Oct 5, 2022

Describe the bug

When autocompleting a function from a namespace that is required using (require ...) the namespace is added in the (:require ...) list of the ns form. This happens even when the function is autocompleted from with in a Rich (comment ...) form.

To Reproduce

From @seancorfield

The ns insert occurs when I accept an auto-complete suggestion from the newly-aliased ns. Here's the before code:

(ns ws.wsql.example)
(comment
  (require '[ws.newrelic.interface :as newrelic]))

Then I start to add a call:

(ns ws.wsql.example)
(comment
  (require '[ws.newrelic.interface :as newrelic])
  (newrelic/))

and at this point it suggests all the functions in that ns so I press tab to select the first one and get this:

(ns ws.wsql.example
  (:require [ws.newrelic.interface :as newrelic]))
(comment
  (require '[ws.newrelic.interface :as newrelic])
  (newrelic/ignore-appdex))

Expected behavior

I think that the ”correct” behaviour here is that clojure-lsp sees that the namespace is already required, and does not automatically add it to the ns form. Might be a good quick-fix suggestion to move the require to there, though?

Screenshots

adding-require.mp4

User details (please complete the following information):

  • OS: Confirmed to not be OS dependent
  • Editor: Happens regardless of editor
  • Version: 2022.10.05-12.59.58-nightly

Additional context

Slack thread with discussion: https://clojurians.slack.com/archives/CPABC1H61/p1664877429715259

@PEZ PEZ added bug Something isn't working editor Related to clojure-lsp on a text editor labels Oct 5, 2022
@ericdallo ericdallo added this to Low priority in clojure-lsp via automation Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working editor Related to clojure-lsp on a text editor
Projects
clojure-lsp
Low priority
Development

No branches or pull requests

1 participant