Comments (3)
Damn, it was me (again) with #3090.
We've different approaches to solve this (by accessing the *.FileType
):
- searching and parsing the
config.RTSyntax
files- expensive, since we've to parse the header from the *.yaml first
- searching and parsing the
config.RTSyntaxHeader
files- less expensive, since we can parse the already created *.hdr faster
- we need to create the *.hdr of the user custom files in the moment we add them to the runtime files
- storing all the available filetypes in the moment we call
UpdateRules()
into a list, which can be accessed later on easily via the buffer- we don't need to parse the files again, since we already did this
- negative side effect: we store it per buffer (maybe better global in the highlighter/parser?)
The last one seems to be the most obvious to me.
from micro.
There is also another approach, which would prefer the most, if we lived in an ideal world: align all *.yaml filenames with their filetype
values, so we can match just by *.yaml filenames. Even better, throw out those filetype
directives as redundant. Keep It Simple, Stupid.
But due to backward compatibility reasons etc we probably don't want to do that.
So, since we need to match by *.FileType
, I think the obvious easy solution is: search and parse built-in filetypes by config.RTSyntaxHeader
files (as we already have them) and user's custom filetypes by config.RTSyntax
. Anything else sounds like a premature optimization at this point, IMHO.
from micro.
But due to backward compatibility reasons etc we probably don't want to do that.
Yep, unfortunately we (I more than you) broke more than necessary.
But yes, KISS fully hit it.
I think the obvious easy solution is: search and parse built-in filetypes by config.RTSyntaxHeader files (as we already have them) and user's custom filetypes by config.RTSyntax.
Ok, then we go with the more expensive approach and sacrifice a few more CPU cycles by parsing again.
I will prepare something to solve my premature first shot.
from micro.
Related Issues (20)
- Copy from micro to another program does not work when micro running over ssh from Git Bash HOT 5
- Big file is freeze the micro for a while HOT 2
- Feature request: inline options HOT 4
- > replace powerful or confusing? HOT 2
- Cut command is very slowly on Windows Terminal HOT 4
- Is the BufWindow the same as BufPane? HOT 1
- Nightly builds are not the current master branch 😭 HOT 2
- Not working command and comnand switch HOT 2
- Micro 2.0.13 (Windows only) crashes when selecting a directory with "open" HOT 1
- IsWhitespace from util package not working HOT 6
- Alt-Shift-Left or Alt-Shift-Right are not recognized desipte getting detected in raw HOT 2
- Disable micro auto formatting bindings.json when adding new bindings HOT 1
- Garbled contents when reloading file with DOS line endings HOT 8
- Inconsistent keybindings behavior for Alt Shift Combinations HOT 4
- file manager plugin .. go up not work HOT 2
- Feature Request: Editor Width/Margins HOT 2
- JumpToMatchingBrace inconsistent with adjacent unpaired braces e.g. )[ or }( or )( HOT 12
- disable error HOT 2
- Confusion over missing bindings
- Differing copy-paste mechanics between tmux and non-tmux 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 micro.