Not signed in (Sign In)

Categories

Vanilla 1.1.1 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorkib2
    • CommentTimeJan 24th 2007
     permalink

    Hi,
    I wondered whether it would be possible to make languages Grammars and Themes extensible, say I developp a C++ library called “SuperKillingParser”, to provide some grammar addon for it, with some theme addon features. In fact, each Grammar/Theme can load dynamically some personnal extensions.

    It is already possible now (you should add your written grammar/theme to the given one), but it’s not practical for sharing them : who cares about “SuperKillingParser” but the users ?

    If someone provides an addon, all themes/grammars will be abble to use it.

  1.  permalink

    Extensible for what? Any practical example?

    • CommentAuthorkib2
    • CommentTimeJan 24th 2007
     permalink

    Essentially for syntax highlightning, ie if you want to highlight the C++ wxWidgets or Qt classes/functions library.

    • CommentAuthorsvenax
    • CommentTimeJan 25th 2007
     permalink

    Isn’t that the way it works already? You can create a wxWidgets bundle that inherits the C++ grammar and also defines extra rules. Maybe not as easily as grammar wxWidgets extends CPP but still, it can be done.

  2.  permalink

    svenax: that’s right

    • CommentAuthorkib2
    • CommentTimeJan 25th 2007
     permalink

    If so, i just copy/paste the C++ grammar, modify it a little to fit the wx lib and call it wxWIdget.itGrammar, that’s it ?
    And after each time i’ll be be using wx, I’m forced to choose wxWidgets “language” bundle. That’s not the way i see it, sorry. Being abble to choose if I want some personnal extensions inside a Grammar is more to the point for me.

  3.  permalink

    No, you don’t have to copy it. It would look like this:

    /* File: wxWidgets.itGrammar */ { title: 'wxWidgets' scope_name: 'source.c++.wxWidgets' patterns: [ { match: /\b(wxAboutBox|wxBeginBusyCursor|wxBell|wxCreateFileTipProvider|wxDirSelector)\b/ name: 'support.function.c++.wxWidgets.Dialog' } ... { include: 'source.c++' } ] }

  4.  permalink

    Also, Intype will remember wxWidgets mapped to .cxx/.cpp file grammar automatically once you select it.

    • CommentAuthorkib2
    • CommentTimeJan 25th 2007
     permalink

    Hi Martin,
    cool, i didn’t know there was such features :)
    Where should i put this file, inside my C++ grammar directory or do i need to create a special one ?

    • CommentAuthormartincohen
    • CommentTimeJan 26th 2007 edited
     permalink

    It would be awesome if you can create separate bundle for it.

  5.  permalink

    I’m not entirely sure if this is the same idea as the original post. But I think it would be good if you could have a folder (probably in the users Application Data folder) that replicated the structure of the Intype folder, and any file within (snippet, grammar, theme etc.) will override the file in the Intype folder with the same name.

    That way, you could add your custom bundles to that, and any additional snippets. If Intype was removed (and the folder deleted) you don’t loose your customisations, and also, if you modified say the, PHP ifelse snippet (which I have, along with many other PHP snippets), you wont loose your changes when Intype is upgraded and the default files copied back in.

    •  
      CommentAuthortstrokes
    • CommentTimeJan 26th 2007
     permalink

    Yeah, I think that is a great idea.
    —tstrokes

    •  
      CommentAuthoryarden
    • CommentTimeJan 26th 2007
     permalink
    and prehaps a shortcut to appData folder from intype's folder
    • CommentAuthorkib2
    • CommentTimeJan 26th 2007
     permalink

    Martin—> It would be awesome if you can create separate bundle for it.
    Unfortunatly, C++ is not my language and I never used wxWidget with it, it was just an example. I’ll try to do some work, but for Python, maybe OCaml ( when I know it better ).
    Moreover, I had to learn a little regexps to build my own Grammars, so I’m waiting till a documentation appears for them.
    And Martin, you didn’t answer my previous question about where these extensions belongs too.

    Jack Sleight—> I’m not entirely sure if this is the same idea as the original post
    No, it’s yours, and I think it’s a good one : keep it :)

  6.  permalink

    Jack Sleight: this is actually called Bundle Item Overriding planned for 0.2.3

  7.  permalink

    Oh, ace, :D

    •  
      CommentAuthorFrederick
    • CommentTimeJan 27th 2007
     permalink

    martincohen: Knew about that but I have a question regarding it — If I would create empty files with the same name as bundle folders (i e “Haml.itBundle”), would they stop the bundle in the application folder from being loaded?

  8.  permalink

    only if the parser considers them as valid, if they are invalid, override algorithm fallbacks to original bundle item…

    •  
      CommentAuthorFrederick
    • CommentTimeJan 27th 2007
     permalink

    Okay, so, if you want to clean out bundles, you have to delete them from the bundles folder of the application. I guess it makes sense.

  9.  permalink

    Nope. There will be mechanism for disabling a bundle. There will be Jasmine file with list of disabled bundles. With Bundle Editor you will be able to disable bundles from the Intype UI.

    •  
      CommentAuthorJack Sleight
    • CommentTimeJan 28th 2007 edited
     permalink

    Martin: Will the preferences files be moved to the users Application Data folder at some point? So that different users can have different settings.

  10.  permalink

    Sure. The next release will introduce new folder named ‘user’ that will be defaut for single-user. However, you will be able to move it to application data folder, or somewhere else in further releases, when we introduce Bundle Items Overriding feature.