Giter Club home page Giter Club logo

Comments (4)

bbatsov avatar bbatsov commented on September 22, 2024 1

@bbatsov: wondering if this cider-locals code (which presumably will never be perfect - hard problem to tackle with Elisp) could be replaced with a simpler approach, namely regarding any symbol that doesn't belong to the namespace interns (defs, refers, imports) as a local.

Yeah, I guess that's not a bad idea, although it might highlight as locals misspelled names. Not a big deal in the end, though.

The idea with the defcustom is a good one IMO, as it will also make it possible to disable this completely if someone runs into problems.

from cider.

vemv avatar vemv commented on September 22, 2024

@bbatsov: wondering if this cider-locals code (which presumably will never be perfect - hard problem to tackle with Elisp) could be replaced with a simpler approach, namely regarding any symbol that doesn't belong to the namespace interns (defs, refers, imports) as a local.

(this can be queried instantly as there's a per-ns cache with that data)

There's the case of var shadowing, but these days local shadowing is less common and there are kondo/etc linters that guard against it.

The worst case is that we sometimes font-lock slightly badly for code that shadows vars, but that bug can also be considered a feature (as it nudges people to do the right thing if they want pretty highlighting).

As a bonus, by not running cider-locals code constantly as the user types stuff, there should be a slight performance/reliability improvement.

from cider.

vemv avatar vemv commented on September 22, 2024

Hammocking it a bit, a very easy change for now would be to introduce a defcustom controlling

cider/cider-mode.el

Lines 777 to 782 in 176a8e7

(defun cider--unless-local-match (value)
"Return VALUE, unless `match-string' is a local var."
(unless (or (get-text-property (point) 'cider-block-dynamic-font-lock)
(member (match-string 0)
(get-text-property (point) 'cider-locals)))
value))

i.e. optionally make it a no-op.

I wouldn't change the default behavior and simply document in the manual when/how to change this.

from cider.

vemv avatar vemv commented on September 22, 2024

Yeah, I guess that's not a bad idea, although it might highlight as locals misspelled names. Not a big deal in the end, though.

Yes, it might also be the case that clj-kondo indicates a non-resolved var as a "squiggly", anyway.

The idea with the defcustom is a good one IMO, as it will also make it possible to disable this completely if someone runs into problems.

Nice, I'll bundle this as part of #3646 .

(when time allows - still running tight in terms of availability)

from cider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.