Possibility to directly make files in the @resource folder from script measure
TheAzack9 opened this issue Β· comments
This is a suggestion, so i hope that this is the right place to suggest things ;)
an example of the behaviour i'm talking about:
[SomeScript]
Measure=Script
ScriptFile=#@#SomeScript.lua
I wonder if it would be possible to right click (or have some key combination) the path to SomeScript.lua and it would automatically generate a .lua file there and open that file or editing. This should ofc only work if the specified path is somewhere in the resource folder :) (though this decision is up to you i guess)
I hope this hasn't been suggested before :P
Anyways, keep up the good work. I love the sublime text package so far π
Edit: forgot how to markdown...
Edit 2: found the title to be misleading...
β¬: wow I misread the whole feature request... I read something totally different but not worse nontheless π
Original answer:
(I thought that you wanted auto complete the ScriptFile
) π
so I tried to implement a prototype and there is a peculiar situation where you use an .inc
-file nested inside a folder. From the main.ini
.file you use
@Include=foo/bar.inc
thus now all paths inside bar.inc
are relative to main.ini
. So if you use a
[Parser]
Measure=Script
ScriptFile=
the ScriptFile
needs to be relative to the main.ini
location if you decide to host your .lua
-script outside of your @Resources
folder.
Example from one of my skins:
Minimal
is the root config pathMinimal/DynamicCalendar
is the current configMinimal/DynamicCalendar/parser
contains everything related to theical
-parserMinimal/DynamicCalendar/parser/WebParser.inc
is an@Include
-fileMinimal/DynamicCalendar/parser/rrule.lua
is a special rule-script used in theWebParser.inc
WebParser.inc
needs to reference the rrule.lua
as parser/rrule.lua
since the main skin inside the current config path.
I know this is special case and not suggested by the documentation but this is also allowed and I do not want to restrict the programmer, if he wants to script more cohesive.
Ok second try to answer that:
I already requested something like that in the past from Merlin, but he refused that. You can read up his answer in the forum thread. I am not sure if I should overwrite his decision due to respect. I might add an config option which is disabled by default and you can enable it.
Sorry for taking so long to reply, i'm overworked at uni atm :P
i couldn't find the forum post you were talking about (though i'll be honest, i didn't look through every single page on the sublime text thread)
I can't really tell you what you want to do with the suggestion, i understand if you don't want to implement it due to respect, but it is currently your project so you do what you think is right ;)
by me
maybe another suggestion
if you press open include on a non-existing file > create file?
Often I type down the strcture in the main-file first
and then have to create all includes first.
would speed up the process imho
MerlinTheRed:
I don't want the script to create files if you try to open non-existing ones. I don't think this is desired behavior for most people. Especially since the script can't know whether what you want to open is a valid path it should create or not. Currently you can just select roughly the lines with paths you want to open and it will open what it finds on those lines, if it exists. Imagine selecting some lines and the script creating files for every line that contains something that looks remotely like a path (like a single word, for example).
I think I just found an acceptable solution (using the ST draft system)
I might be wrong, but wouldn't a simple dialog that asks, "could not find file, do you want to generate it?" fix the issue merlin is describing?
anyways, you found a fix ;) i hope it works out π
Yes, but luckily ST3 has a better mechanism for that: drafts.
This is, when you create a new file and you can already edit it and persist in the cache, but you can decide later on if you want to save it or not. Additionally, you are getting a highlight if it is already saved or not.
The main problem is still, that the checking for the location must be correct (due to includes just being copy paste into the main configuration .ini
). I am currently developing a way to generate an include mapping, where you can see in which configurations an inc
was included.