Giter Site home page Giter Site logo

Comments (3)

JoeKar avatar JoeKar commented on June 17, 2024

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.

dmaluka avatar dmaluka commented on June 17, 2024

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.

JoeKar avatar JoeKar commented on June 17, 2024

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)

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.