Code Monkey home page Code Monkey logo

Comments (4)

purcell avatar purcell commented on July 18, 2024

The expression (nth 3 (syntax-ppss)) returns non-nil when point is inside a string, so this would be easy enough to do. I tend to agree when viewing this simplistically, but there's a compelling counterpoint: inside strings in Ruby and other languages, you can interpolate code, e.g. "hello #{name}". And when point is inside the interpolated code, e.g. on name, then (nth 3 (syntax-ppss)) still returns non-nil. It's pretty clear to me that a user would still want name to be highlighted here.

from symbol-overlay.

langston-barrett avatar langston-barrett commented on July 18, 2024

@purcell thanks for the quick response! You're totally right about languages like Python and Ruby with that style of format string. What about a toggle (with the default being the current behavior)? One could then enable or disable it in a major mode hook or similar.

from symbol-overlay.

Hi-Angel avatar Hi-Angel commented on July 18, 2024

Please, if you decide to address it, either leave it opt-in, or make such behavior very explicit in readme.md. People expect this mode would highlight anything that is under the caret, and if it doesn't, this looks like a bug. In fact, there's an actual bug where the mode doesn't highlight words sometimes.

from symbol-overlay.

purcell avatar purcell commented on July 18, 2024

My preference overall is to not add any new logic relating to this. It would be hard to implement in a sensible way. e.g. what happens if "highlighting in strings" is disabled, but a user actively tries to highlight a specific word in a string. Should that be a no-op?

In theory it looks like you could already easily get this effect on a mode-by-mode basis by adding your own function into symbol-overlay-ignore-functions: see here.

from symbol-overlay.

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.