Giter Club home page Giter Club logo

Comments (9)

jesseleite avatar jesseleite commented on July 17, 2024

You can just edit the regex by adding this line to Highlighter's User Settings File:

{
   "highlighter_regex": "(\t+ +(?![*]))|(^ +)|( +\t+)|[\u2026\u2018\u2019\u201c\u201d\u2013\u2014]|[\t ]+$"
}

Specifically, I took the first regex matching conditions (\t+ +), and added (?![*]) to the end. This prevents Highlighter from highlighting mixed tabs+spaces+asterisk which is used by DocBlockr style comment blocks.

@bluegray @Flynsarmy, Do either of you see this conflicting with other code libraries/styles? Seems to work well for me though.

from highlighter.

Flynsarmy avatar Flynsarmy commented on July 17, 2024

@JerseyMilker Yea, I knew I could edit the regex but thought it would be a good idea to make an issue to get the default changed instead of making every single PHP dev out there come up with this fix themselves :)

from highlighter.

jesseleite avatar jesseleite commented on July 17, 2024

Makes sense. I agree, this style of comment blocking is fairly common :) @bluegray, if you find my regex modification above to be sound, I would add my +1 for changing the regex default. Off-hand, I can't think of any instances where this modification to the regex might clash with someone else's programming style.

from highlighter.

bluegray avatar bluegray commented on July 17, 2024

Agreed, I don't see any harm, and it looks to be a common comment style. I changed the default: c13420e

from highlighter.

jesseleite avatar jesseleite commented on July 17, 2024

@bluegray, Wonderful thank you! :)

from highlighter.

jesseleite avatar jesseleite commented on July 17, 2024

I don't see the automatic update from package control. Do you have to push the updated repo to package control?

from highlighter.

bluegray avatar bluegray commented on July 17, 2024

I suspect it takes a while to update, if it doesn't update after a long while, let me know ;)

from highlighter.

jesseleite avatar jesseleite commented on July 17, 2024

Okay thanks.

PS. I know this is off-topic, but I see there's now two regex lines we can configure, highlighter_regex and highlighter_regex_cool. I understand the latter is for those unicode chars, but I am curious why you separated the regex into two lines? And why is it called _cool?

from highlighter.

ericmagnuson avatar ericmagnuson commented on July 17, 2024

The above regex was selecting spaces (not just if they were mixed with tabs), so I took out the (^ +), thus giving me the following:

(\t+ +(?![*]))|( +\t+)|[\u2026\u2018\u2019\u201c\u201d\u2013\u2014]|[\t ]+$

Seems to work correctly now, only selecting mixed whitespace or a docblock with more than one space after the tab (because you never will have your asterisk more than one space in from my experience).

from highlighter.

Related Issues (16)

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.