How to add additional syntax files to Scribble?
  • Order of the Butterfly
    Order of the Butterfly
    asrael22
    Posts: 404 from 2014/6/11
    From: Germany
    Hi.

    I'd like to add additional syntax language files to Scribble.
    In Notepad++ it's possible by adding a file to some folder where Notepad++ will pick it up.
    Is that possible in Scribble as well?


    Manfred
  • »23.03.16 - 06:50
    Profile
  • MorphOS Developer
    geit
    Posts: 1049 from 2004/9/23
    Quote:


    I'd like to add additional syntax language files to Scribble.
    Is that possible in Scribble as well?



    No. It is hardcoded right now.
  • »23.03.16 - 09:04
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    asrael22
    Posts: 404 from 2014/6/11
    From: Germany
    That's unfortunate.

    Manfred
  • »23.03.16 - 15:45
    Profile
  • MorphOS Developer
    Nadir
    Posts: 162 from 2003/3/17
    Such support was always something I wanted to add to Scribble but it was never a real priority. It involves quite a bit of work to do that properly since it's not only about keywords but has to do with a whole bunch of settings related to file types and the lexer.

    Just out of curiosity, which are the filetypes you are interested in?

    /Nicholai
  • »23.03.16 - 16:43
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    asrael22
    Posts: 404 from 2014/6/11
    From: Germany
    Alright, I thought there was some common control of this with Scintilla already.
    But from your answer it seems there is no such a thing.

    I would think of Arexx or Oberon (which is similar to Pascal, but not quite). And it would be great if the Notepad++ language extensions could be used somehow.


    Manfred
  • »23.03.16 - 17:31
    Profile
  • MorphOS Developer
    CISC
    Posts: 619 from 2005/8/27
    From: the land with ...
    Quote:

    asrael22 wrote:
    And it would be great if the Notepad++ language extensions could be used somehow.


    Notepad++ uses it's own (UDL) system, which while it improved in 2.x it's still quite limited, and nowhere near a full Lexer...


    - CISC
  • »23.03.16 - 19:03
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    asrael22
    Posts: 404 from 2014/6/11
    From: Germany
    Yeah, OK.
    Whatever you think is good.
    But it would also be great to be able to use a large library of existing language plugins.


    Manfred
  • »23.03.16 - 19:20
    Profile
  • MorphOS Developer
    Nadir
    Posts: 162 from 2003/3/17
    Quote:

    asrael22 wrote:
    Alright, I thought there was some common control of this with Scintilla already.
    But from your answer it seems there is no such a thing.

    I would think of Arexx or Oberon (which is similar to Pascal, but not quite). And it would be great if the Notepad++ language extensions could be used somehow.


    Manfred


    I have already added ARexx language support to Scribble but as far as I remember it is indeed not in the last public version. As for Oberon, there is no Scintilla lexer available but if you say that the Pascal one is good enough, I could add support it if you tweak Scite (for Windows, Linux or Mac) and then send me the properties file.

    As for Notepad++, it is GPL to there is no way I'm even going to look at the source code. If anything, I might support something like Scite Script lexers (http://www.scintilla.org/ScriptLexer.html) as this would fit better with the Lua support that is already in Scribble and probably also more powerful than UDL.

    Best,

    Nicholai
  • »23.03.16 - 19:26
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    asrael22
    Posts: 404 from 2014/6/11
    From: Germany
    Well, I think I'm not up to the topic to really make any suggestions.
    I can only say what I'd like from a user perspective.
    Something extendable, not hard-coded would be great.
    However that is done I don't really care.
    Command scripts which can build and run code, etc. would also be great.
    On OS X I'm working with TextMate(TM2 is on GitHub) and Sublime which are also very extendable and great editors. Maybe worth a look.


    Manfred
  • »23.03.16 - 19:45
    Profile
  • MorphOS Developer
    Nadir
    Posts: 162 from 2003/3/17
    Quote:

    asrael22 wrote:
    Something extendable, not hard-coded would be great.
    Manfred


    Yes, I agree and and at some stage I will definitely do something about it ;-)

    Quote:


    Command scripts which can build and run code, etc. would also be great.
    On OS X I'm working with TextMate(TM2 is on GitHub) and Sublime which are also very extendable and great editors. Maybe worth a look.
    Manfred


    I also use TextMate sometimes but when it comes to scripting, I would argue that Scribble is already much more powerful than TM. Did you ever try to write some Lua scripts or even record some? You can easily do something like the command scripts you hint at.

    One of the biggest problem is documentation really, an area where I never seem to make any real progress. Scribble has so many features that probably only I use.

    Any help with that would be most welcome by the way ;-)
  • »23.03.16 - 20:56
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    asrael22
    Posts: 404 from 2014/6/11
    From: Germany
    I'm looking at the example scripts.
    Is there an api documentation for the editor component? For example how to retrieve the path of the current file, selected text, etc.


    Manfred
  • »24.03.16 - 14:14
    Profile
  • MorphOS Developer
    Nadir
    Posts: 162 from 2003/3/17
    Quote:

    asrael22 wrote:
    I'm looking at the example scripts.
    Is there an api documentation for the editor component? For example how to retrieve the path of the current file, selected text, etc.
    Manfred


    Basically, Scribble uses a re-implementation of the Scite Lua Scripting Extension. While the interface should be broadly compatible, it works quite diffently and over an ARexx bridge.

    Still you can have a look at the following documentation for Scite to get an overview of the capabilities. My implementation should cover almost everthing except for the event call-back interface which isn't supported yet (difficult over the ARexx bridge).

    http://www.scintilla.org/SciTELua.html
    http://www.scintilla.org/PaneAPI.html
    http://scite-files.googlecode.com/svn-history/trunk/extras/SciTELua.api

    On top of this API, most Scribble menu actions can be accessed via the same Lua interface. The best way to find out the respective command is probably to record a short macro and check what it does.

    One thing that is still largely missing is a way to access Scribble properties/constants (as opposed to Scintilla ones which are supported). It is therefore not possible to find out the name of the current file. I will try to find the time to add that before the next release.

    I hope this was helpful. Unfortunately, the lack of good documenation makes all of this look much more difficult than it really is.

    Any feedback is most welcome, also on IRC.

    Best,

    Nicholai
  • »24.03.16 - 21:40
    Profile
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    deka
    Posts: 136 from 2013/2/12
    From: Hungary, Kecsk...
    @Nadir:

    Scintilla is a nice tool and good to see the progress at every new MOS release.

    If there are mentioned some missing features, I also have one:
    It could be nice to highlight the functions/defines from included headers in the given source file.

    A documentation also could be nice, since I use Scribble as a basic editor (as other guys, I bet).
  • »25.03.16 - 07:16
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    asrael22
    Posts: 404 from 2014/6/11
    From: Germany
    OK. I've tried a bit and could add, replace some text in the editor and put some text in the output pane.
    That pretty simple.

    I'd like to create a runner script, for ARexx, Python or also Lua, that executes what is in the editor.
    When you say it's not possible to retrieve the filename of the file currently open in the editor, how else can this be done?
    I'd think in a script I'd get all text from the editor store it temporarily in a file and execute that with the interpreter?


    Manfred
  • »25.03.16 - 11:07
    Profile
  • MorphOS Developer
    Nadir
    Posts: 162 from 2003/3/17
    For Lua code, you can just loadstring() the contents of the editor window and then execute it. For other interpreted languages, it might be possible to pass a command string as an argument.

    An alternative would be if the file name/path was specified in the file, in which case your script could parse that information.

    Anyway, I will try to find the time to add file name attribute handling for the next version.

    Best,

    Nicholai
  • »26.03.16 - 15:04
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    asrael22
    Posts: 404 from 2014/6/11
    From: Germany
    Thanks, that would be great.

    I think it would also be great if the language setting would set a context so that scripts, that are bound to a certain key-shortcut, can be different from context to context.
    I.e. I want to create and run some ARexx code from the editor, so I'll set the ARexx language. Setting that activates the script shortcut CTRL-R to run the ARexx code.
    However editing a Python file will enable the shortcut CTRL-R with a different script that runs the Python code.


    Manfred
  • »27.03.16 - 12:29
    Profile
  • MorphOS Developer
    Nadir
    Posts: 162 from 2003/3/17
    Quote:

    asrael22 wrote:
    Thanks, that would be great.
    I think it would also be great if the language setting would set a context so that scripts, that are bound to a certain key-shortcut, can be different from context to context.
    I.e. I want to create and run some ARexx code from the editor, so I'll set the ARexx language. Setting that activates the script shortcut CTRL-R to run the ARexx code.
    However editing a Python file will enable the shortcut CTRL-R with a different script that runs the Python code.
    Manfred


    I think that would complicate things unnecessarily in the majority of cases so I would be hesitant to add such a feature.

    Having said that, your script can already now check which lexer is set in a particular editor instance and take different actions depending on the results (check the scintilla documentation for details), which means you can effectively do what you are asking for quite easily.
  • »27.03.16 - 17:01
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    asrael22
    Posts: 404 from 2014/6/11
    From: Germany
    Quote:


    I think that would complicate things unnecessarily in the majority of cases so I would be hesitant to add such a feature.


    I can understand that it might be quite a bit of work.
    However, consider that a language (or other) plugin is more than just a syntax highlighting.
    It's more, like snippet or template shortcuts, compile or run scripts, documentation, etc.
    Being able to bundle such things as plugin using a common API would be a great thing.

    Manfred

    [ Edited by asrael22 28.03.2016 - 11:12 ]
  • »27.03.16 - 18:55
    Profile
  • MorphOS Developer
    Nadir
    Posts: 162 from 2003/3/17
    Quote:

    asrael22 wrote:
    <quote>
    I think that would complicate things unnecessarily in the majority of cases so I would be hesitant to add such a feature.
    </quote>
    I can understand that it might be quite a bit of work.
    However, consider that a language (or other) plugin is more than just a syntax highlighting.
    It's more, like snippet or template shortcuts, compile or run scripts, documentation, etc.
    Being able to bundle such things as plugin using a common API would be a great thing.

    Manfred


    When I spoke of complexity, I didn't mean that it would be difficult on my side. I just think it would be confusing for most users if keyboard shortcuts differed between languages. Imagine if you had several file types open in different tabs. Shortcuts would then change as you switch tabs? I think this would be confusing for most people, including myself.

    Anyhow, when I get the time I will extend the lua interface so that more advanced plugin interfaces would be feasible and then I'll look forward to try out your plugin ;-)

    For the time being, my focus is to finish the IDE functionality in Scribble (work space tree, project setting, makefile generator and so on) and an integrated debugger.
  • »27.03.16 - 20:52
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    tolkien
    Posts: 523 from 2013/5/29
    Quote:

    Nadir escribió:

    For the time being, my focus is to finish the IDE functionality in Scribble (work space tree, project setting, makefile generator and so on) and an integrated debugger.



    Yes please! That would be great!!
    MorphOS: PowerMac G5 - PowerBook G4 - MacMini.
    Classic: Amiga 1200/060 - A500 PiStorm
  • »28.03.16 - 05:02
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    asrael22
    Posts: 404 from 2014/6/11
    From: Germany
    Quote:


    When I spoke of complexity, I didn't mean that it would be difficult on my side. I just think it would be confusing for most users if keyboard shortcuts differed between languages. Imagine if you had several file types open in different tabs. Shortcuts would then change as you switch tabs? I think this would be confusing for most people, including myself.


    Well, I think it's just a different thinking.
    When I want to run a script I want to use the same key-shortcut no matter which tab is active and which language is therein.
    The plugins could be given a key-shortcut range that they overwrite.
    But there may also be a range of key-shortcuts that are commonly available.

    Quote:


    Anyhow, when I get the time I will extend the lua interface so that more advanced plugin interfaces would be feasible and then I'll look forward to try out your plugin


    I have created plugins for TextMate which I use for myself as I basically use TM on a daily basis.
    Whether I make them publicly available is another matter.

    Quote:


    For the time being, my focus is to finish the IDE functionality in Scribble (work space tree, project setting, makefile generator and so on) and an integrated debugger.


    You mean a C/C++ IDE?

    You do what you think is best.
    Don't get me wrong. I appreciate what you're doing. Scribble is by far the best editor around for MorphOS.
    I'm just juggling ideas.
    The plugin concept, with the right API, could open up for really powerful plugins that could extend the functionality and be a separated entity.
    And, it would open up for collaboration.
    Imagine something like your IDE functionality could be implemented as a plugin.
    You'd have a bunch of people that could work on it if it'd be in a public repo, without people hacking the editor base code.


    Manfred
  • »28.03.16 - 15:18
    Profile
  • MorphOS Developer
    Nadir
    Posts: 162 from 2003/3/17
    Quote:


    Well, I think it's just a different thinking.
    When I want to run a script I want to use the same key-shortcut no matter which tab is active and which language is therein.
    The plugins could be given a key-shortcut range that they overwrite.
    But there may also be a range of key-shortcuts that are commonly available.



    One could of course do something like that but since the existing interface already allows you to do what you asked for, I do not see why it should be changed to be honest.

    Quote:


    You mean a C/C++ IDE?



    Yes, mainly for those languages. The functionality I had planned is almost where I wanted it to be when I started this project 8 months ago or so. It required quite a bit of internal reorganisation of Scribble and that turned out to be quite a bit more complex than I first imagined.

    Quote:


    Imagine something like your IDE functionality could be implemented as a plugin.
    You'd have a bunch of people that could work on it if it'd be in a public repo, without people hacking the editor base code.
    Manfred


    Sure, a plugin interface is a neat idea but it is no panacea. In our situation, it is actually not quite sure how much traction it would get.

    1) The size of the MorphOS community is very small and I don't expect dozens of independent developers to embark on writing plugins for Scribble. That's also the experience I had when adding Lua support: I got some feedback but not much from people who were interested in using it for plugin support, even though this is an obvious avenue. I would likely have extended missing parts earlier if I had received a lot of feedback.

    To be more concrete, I could have spent 8 months refining the plugin interface and then the next version of Scribble would still not have had decent IDE functionality. The economies of scale that come with a plugin interface only work if there are a lot of third party developers eager to contribute. I don't see that at the moment, unfortunately.

    2) Implementing something like the IDE functionality as an independent module is always going to be more difficult than doing it as part of the editor, in particular if one wants really tight and well-functioning integration.

    3) To be honest, I prefer important parts of editor/IDE to be in my/the team's control to ensure some reasonable quality that also meets the needs of the core MorphOS team for internal development.

    Anyhow, I still want to continue extending the existing plugin interface. I'm quite happy with the Lua route I picked because it fits nicely with the script language we have chosen as an ARexx replacement and it also allows us to benefit from the existing community of Scite users. Many of the example scripts that I included with Scribble come from this page for instance:

    http://lua-users.org/wiki/SciteScripts

    The next step regarding Lua is to expose more Scribble-specific attributes (most important methods are already covered) and to find a solution regarding call-backs. The latter is really important in order to write more complex plugins but would likely require that I integrate the Lua instances into Scribble rather than using LuaX as is currently the case. That's feasible but takes some effort.

    By the way, I do appreciate your feedback. Sometimes I just have quite strong opinions on what I want to do with Scribble since I spent the last six years working and thinking about it.
  • »28.03.16 - 18:28
    Profile
  • Yokemate of Keyboards
    Yokemate of Keyboards
    Zylesea
    Posts: 2057 from 2003/6/4
    Quote:

    asrael22 schrieb:
    Quote:


    I think that would complicate things unnecessarily in the majority of cases so I would be hesitant to add such a feature.


    I can understand that it might be quite a bit of work.
    However, consider that a language (or other) plugin is more than just a syntax highlighting.
    It's more, like snippet or template shortcuts, compile or run scripts, documentation, etc.
    Being able to bundle such things as plugin using a common API would be a great thing.

    Manfred

    [ Edited by asrael22 28.03.2016 - 11:12 ]


    Why don't you use Cubic?
    --
    http://via.bckrs.de

    Whenever you're sad just remember the world is 4.543 billion years old and you somehow managed to exist at the same time as David Bowie.
    ...and Matthias , my friend - RIP
  • »28.03.16 - 22:32
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    asrael22
    Posts: 404 from 2014/6/11
    From: Germany
    Quote:

    Zylesea wrote:
    Why don't you use Cubic?


    I tried.
    But I'm unable to get used to the way text is marked, cut and copied and such.
    Also the plugin stuff is by far too complicated for me.
    There are lots of folders where things are and I don't know where to put what.
    It's too grown and it seems it never was cleaned up.


    Manfred
  • »29.03.16 - 07:37
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    r-tea
    Posts: 306 from 2005/3/27
    From: Poland, Zdzies...
    Quote:

    Nadir wrote:
    I have already added ARexx language support to Scribble but as far as I remember it is indeed not in the last public version. As for Oberon, there is no Scintilla lexer available but if you say that the Pascal one is good enough, I could add support it if you tweak Scite (for Windows, Linux or Mac) and then send me the properties file.



    I'd like to see Hollywood scripts support in the next release. Would be hard to implement it?
    Mac mini G4@1,5GHz silent upgrade + Xerox Phaser 3140 + EPSON Perfection 1240U
    Commodore C64C + 2 x 1541II + Datasette + SD-Box

    I miss draggable screens... and do you? I know I'm in a minority unfortunately.
  • »01.04.16 - 23:15
    Profile