thatsIch / sublime-rainmeter

Rainmeter Package for Sublime Text 3

Home Page:https://thatsich.github.io/sublime-rainmeter/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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...

Thanks for the feature request! Glad you like it πŸ˜ƒ

Sounds like a good feature πŸ‘ and easy to implement.

thinking-face
I think

I will take a look at it and report back. I am currently a bit short on time because I have to finish a project by wednesday 😨.

€: 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 path
  • Minimal/DynamicCalendar is the current config
  • Minimal/DynamicCalendar/parser contains everything related to the ical-parser
  • Minimal/DynamicCalendar/parser/WebParser.inc is an @Include-file
  • Minimal/DynamicCalendar/parser/rrule.lua is a special rule-script used in the WebParser.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.