Skip to content

Commit 8e1c910

Browse files
committed
Documentation update
1 parent 0ec9dff commit 8e1c910

File tree

2 files changed

+85
-9
lines changed

2 files changed

+85
-9
lines changed

CHANGELOG.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
11
# Changelog
22

3-
## [Unreleased]
3+
4+
## [0.1.1]
5+
6+
### Added
7+
8+
- a bunch of preliminary versions for small regions of interest were added in the unofficial features.
9+
10+
- recommendation has been updated to include links to the gitter chanell
11+
12+
- the sublime menu has been edited accordingly as well!
13+
14+
15+
16+
### Fixed
17+
18+
- fixed a nasty bug in the argument queries, which prevented above/below queries to select parts of calls inside with clauses and for loops( it did not affect counting though)
19+
20+
- documentation fix, the documentation for the same keyword was pointing to the unofficial small regions of interest
21+
22+
### Changed
23+
24+
- the escaping problems faced with quotes and other special characters were lifted( see below for details )
25+
26+
- the repair module now supports correcting cases where the return keyword is followed by invalid code
27+
28+
29+
30+
31+
32+
33+
34+
## [0.0.5 and 0.1.0 are not really change loged properly]
435

536
### Added
637

doc/README.md

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
- [Grammar Plug-In Interface](#grammar-plug-in-interface)
1313
- [Core Idea](#core-idea)
1414
- [Technicalities](#technicalities)
15+
- [Update](#update)
16+
- [Old Technicalities](#old-technicalities)
17+
- [Overcoming The Above Technicalities](#overcoming-the-above-technicalities)
1518
- [I am lazy And I Know It](#i-am-lazy-and-i-know-it)
1619
- [Linux and Aenea](#linux-and-aenea)
1720
- [Sublime Settings](#sublime-settings)
@@ -133,8 +136,7 @@ Feedback Is Much Appreciated!
133136
This section deserves more documentation than currently is being provided so at some point I would see that it gets a page off its own.
134137

135138

136-
For communication between the grammar and the main plug-in the [sublime command line interface](https://www.sublimetext.com/docs/3/osx_command_line.html) is used.
137-
139+
For communication between the grammar and the main plug-in the [sublime command line interface](https://www.sublimetext.com/docs/3/osx_command_line.html) is used. Up to version 0.1.0, this meant that we invoked the `subl` utility via the shell but this has changed with 0.1.1! instead it invokes it into sub process directly via dragonfly's builtin `RunCommand`!
138140

139141
#### Core Idea
140142

@@ -149,24 +151,34 @@ out of which sublime is going to make a command with a name
149151
"python_voice_coding_plugin"
150152
```
151153

152-
When this command is invoked one way or another, it will run the following method
154+
This command can be invoked in a variety of ways, ranging from to open up the sublime console and type something like
155+
156+
```python
157+
view.run_command("python_voice_coding_plugin",{ arguments in json dictionary format})
158+
```
159+
160+
to having it binded to some keypresses, some icon in the sublime menu, some command in the command palette via a .sublime-commands file or something,
161+
162+
down to what we are interested in, directly via the command line interface.
163+
164+
However this command is invoked , it will run the following method
153165

154166
```python
155167
def run(self, edit,arg):
156168
```
157169

158170
where `edit` is something supplied from sublime and `arg` is an argument I defined and is going to be a dictionary containing all the information we need to describe the query.
159171

160-
so the plan is to invoke the command line with the following command
172+
so the plan is to invoke the command line with the something like the following
161173

162174
```bash
163175
subl --command python_voice_coding_plugin { "arg" : {
164-
our parameters
176+
our parameters inside a dictionary
165177
}
166178
}
167179
```
168180

169-
181+
and our `python_voice_coding_plugin` will be invoked with the parameter `arg` containing the dictionary with our extras!
170182

171183
Suppose we use a command like
172184

@@ -204,7 +216,7 @@ Choice("operation",{
204216
Since none of them were spoken and it has no default value, we don't send anything for it.
205217

206218

207-
The script is going to invoke the subl commandline tool with a command like that ignoring some technicalities looks like
219+
The script is going to invoke the subl tool with a command like that ignoring some technicalities looks like
208220

209221
``` bash
210222
subl --command python_voice_coding_plugin { "arg" : {
@@ -219,6 +231,12 @@ subl --command python_voice_coding_plugin { "arg" : {
219231

220232
#### Technicalities
221233

234+
##### Update
235+
236+
This typicality is have been sidestepped for version 0.1.1 for the Windows version, Aenea unfortunately still has some issues but I'll try to work on them! nonetheless you should be aware that these do not prevent users of the plug-in and excluding some trouble with the [paste back formatting options](./Operations.md#Experimental-Formatting-Options) you should be fine!
237+
238+
##### Old Technicalities
239+
222240
Now in reality what it will send is going to be
223241

224242
```bash
@@ -232,7 +250,9 @@ which is a little bit different because
232250
* You see 2 seemingly random key value pairs appearing, these correspond to parameters that appear in other specs of the grammar and have default values.
233251

234252

235-
but the latter of the two I do not really consider that much of a problem. What I did have a problem with was forcing sublime to stay on focus after executing the command. to solve this issue I am currently sending second essentially empty `subl` command, which does not satisfy me that much and is not hundred percent bulletproof.
253+
but the latter of the two I do not really consider that much of a problem. What I did have a problem with was
254+
255+
* forcing sublime to stay on focus after executing the command. to solve this issue I am currently sending second essentially empty `subl` command, which does not satisfy me that much and is not hundred percent bulletproof.
236256

237257
furthermore I'm not sure if this line
238258

@@ -242,6 +262,31 @@ subprocess.call(y, shell = True)
242262

243263
is the best but it currently works
244264

265+
#### Overcoming The Above Technicalities
266+
267+
While working on this [proof of concept](https://github.com/mpourmpoulis/CasterSublimeSnippetInterfaceExample) which removes the need for `.sublime-snippet` files , I came across the same technicalities and after some experimenting managed to come up with a clean solution.
268+
269+
The core idea lies in instead of running the command in the shell,we can directly create it as a subprocess and directly pass it a list of string parameters, avoiding the extra complication that escaping special characters ,such as `"`,`^`,`&`, and whatever your shell recognizes spatial, brings with it!
270+
271+
a small issue is that special care must be taken so that the sub processes does not open a GUI window that would disturb the user interface. I managed to find a not that clean solution
272+
273+
```python
274+
def send_sublime(c,data):
275+
subprocess.Popen(["subl","-b", "--command",c + " " + json.dumps(data)],creationflags = 0x08000000)
276+
```
277+
278+
279+
Only to realize that this can be done much neater with the builtin dragonfly2 action [`RunCommand`]()
280+
281+
```python
282+
def send_sublime(c,data):
283+
RunCommand(["subl", "-b","--command",c + " " + json.dumps(data)],synchronous = True).execute()
284+
```
285+
286+
which is of course preferable! please note that in either case the command name and the json data still have to be wrapped inside a single argument.
287+
288+
furthermore I also found but I also need to set the `-b` background flag to resolve my focusing issues, so now everything can be done with a single invocation!
289+
245290

246291
#### I am lazy And I Know It
247292

0 commit comments

Comments
 (0)