Home Download Buy Blog Forum Support

How to create a new language?

Re: How to create a new language?

Postby jps on Fri Apr 04, 2008 8:48 am

There's no way to get that yet, I'll add a couple of functions for the next beta:

view.syntaxName(point): Get the name at the given point
view.matchSelector(point, selector): Evaluate the selector vs. the name at the given point, returning True iff it matches
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: How to create a new language?

Postby SteveCooperOrg on Fri Apr 04, 2008 5:25 pm

That sounds great. Then I can scan through the file, building up an index of (position, syntax names). That'll give me enough to build a hierarchy. Thanks.
Maybe what you're looking for is at the http://www.sublimetextwiki.com
SteveCooperOrg
 
Posts: 193
Joined: Thu Mar 20, 2008 9:53 am

Re: How to create a new language?

Postby kib2 on Fri Apr 04, 2008 8:39 pm

Hi,

I've made a reStructuredText package for Sublime here http://kib2.free.fr/Sublime/reStructuredText.sublime-package,
no problem for the syntax highlighting but I've got some with the only snippet inside (I don't know why exactly, and don't have much time yet).

All files are utf-8 encoded because I'm currently working with Sublime under Linux+wine (the only thing annoying is that I can't launch my Python scripts from wine).

See you, hoping to see a Linux version soon :)
kib2
 
Posts: 38
Joined: Sun Mar 23, 2008 8:30 am
Location: France

Re: How to create a new language?

Postby jps on Fri Apr 04, 2008 10:39 pm

Nice stuff!

The key binding should be using "text.restructedtext" rather than "source.restructuredtext" for the context, as that's what reStructuredText.tmLanguage declares (You can see it when you've got a file open using that syntax highlighting, and press Ctrl+Alt+P)
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: How to create a new language?

Postby kib2 on Sat Apr 05, 2008 7:46 am

Thanks for the tip Jon,

I will try to add some snippets now.
Do you know how to launch a Python script from Sublime under Wine ?
kib2
 
Posts: 38
Joined: Sun Mar 23, 2008 8:30 am
Location: France

Re: How to create a new language?

Postby jps on Sat Apr 05, 2008 2:35 pm

As in, to have Tools/Build System/Python work?

It relies on python.exe being in the system path, perhaps that's what's not working for you under Wine.
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: How to create a new language?

Postby kib2 on Sat Apr 05, 2008 5:04 pm

jps wrote:As in, to have Tools/Build System/Python work?

It relies on python.exe being in the system path, perhaps that's what's not working for you under Wine.


That's the problem indeed : can I set it to my own Python's executable under Linux ?
kib2
 
Posts: 38
Joined: Sun Mar 23, 2008 8:30 am
Location: France

Re: How to create a new language?

Postby jps on Sat Apr 05, 2008 11:40 pm

If you edit the file Packages/Python/Python.sublime-build (Normally found under C:\Documents and Settings\<username>\Application data\Sublime Text on XP), then you can try changing 'python.exe' to /usr/bin/python, and see if that works.
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: How to create a new language?

Postby kib2 on Sun Apr 06, 2008 8:56 am

Hi Jon,

I've tried without success.

My build command is not set to this one :

Code: Select all
buildCommand exec ' *File "(...*?)", line ([0-9]*)' usr/bin/python'"$File"'


(What's the 'line ([0-9]*' ? I suspect in the future I could choose some part of code to run, that's it ? )

Here's the message Sublime send me :

Code: Select all
running command /usr/bin/python'"Z:\home\kib\Bureau\Programmation\Python\RecupBases\recup.py"'
Spawn: trying c:\windows\system32\cmd.exe /A /S /C "/usr/bin/python'"Z:\home\kib\Bureau\Programmation\Python\RecupBases\recup.py"'"


A few questions now:

- How can I set the console output by default ? I haven't seen any option in configuration files for it.
- Can snippets be nested inside each other ?
- Does code folding is on your todo list ?

Thanks again.
kib2
 
Posts: 38
Joined: Sun Mar 23, 2008 8:30 am
Location: France

Re: How to create a new language?

Postby jps on Sun Apr 06, 2008 1:50 pm

kib2 wrote:How can I set the console output by default ? I haven't seen any option in configuration files for it.


I'm not quite sure what you mean here, could you elaborate a bit?

Can snippets be nested inside each other ?


Do you mean, some directive inside the *.sublime-snippet file to include another snippet? There's no functionality for that yet, I can add it to the todo list though.

Does code folding is on your todo list ?


It sure is! It's behind things like the project manager and symbol list in priority though.
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

PreviousNext

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 10 guests