Comments (9)
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.
@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.
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.
Agreed, I don't see any harm, and it looks to be a common comment style. I changed the default: c13420e
from highlighter.
@bluegray, Wonderful thank you! :)
from highlighter.
I don't see the automatic update from package control. Do you have to push the updated repo to package control?
from highlighter.
I suspect it takes a while to update, if it doesn't update after a long while, let me know ;)
from highlighter.
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.
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)
- Could you add a MIT-LICENSE to this repo maybe?
- User preference for ignored syntax types? HOT 2
- 4 space indent HOT 1
- Add Command Palette commands for enable/disable? HOT 2
- Language-specific Highlighter settings
- Disable highlight in build results view.
- Add «insecable» space by default HOT 1
- Highlighter for comments HOT 1
- sublime text 2 DEFAULT_FLAGS_COOL issue
- Highlight consecutive lines starting with different whitespaces
- Highlighter doesn't start automaticaly HOT 3
- Adding ideographic space into the default highlighted characters HOT 1
- Create scope blacklist HOT 4
- Add support for ALL hidden characters HOT 1
- Dash (–) gets highlighted by default HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from highlighter.