Giter Site home page Giter Site logo

mpourmpoulis / pythonvoicecodingplugin Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 3.0 10.23 MB

Sublime Text 3 plugin for voice coding Python 3

Home Page: https://pythonvoicecodingplugin.readthedocs.io/en/latest/

License: BSD 2-Clause "Simplified" License

Python 100.00%
sublime-text-plugin voice-programming accessibility grammar dragonfly python3 syntax-tree voice-coding high-level

pythonvoicecodingplugin's People

Contributors

mpourmpoulis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pythonvoicecodingplugin's Issues

Create unit tests to verify code coverage

the previous days I have finally gotten around to setting up Travis CI for the project starting with pylint and the next step is to include unit tests in the integration. Unfortunately, because the Python interpreter is embedded in sublime and I outsource a couple of things to the sublime, setting up of those unit tests requires solving various technicalities so it will happen gradually.

As a start, I should probably start with unit tests for the library folder, is it these essentially sublime free, and in particular tests regarding the ability (of the repair module) to recover from errors and parse code. For the purpose, I think I should try to collect samples of code for three different tasks

  • Code that contains errors, that it is essential to be able to recover from, and failure to do so would imply there is a bug in the code and the travis build should fail

  • Code with errors, it would be nice to support but not really hard line for the moment. Failure should be reported but should not cause the Travis build to fail

  • Correct Code, that the repair module should not break

Need to add support for picking up lambda parameters

Currently there is support for grabbing I either the entire lambda Or its body but not its parameters. On the same time log off proper handling of Lambdas from generic_fixresulted in #17 so the whole issue you should be addressed By 0.2.0 release

Idea: Consider adding a new "inner" keyword for argument queries

I have been considering these as a supplement to the inside keyword, by having it Work in a way similar to outer_keyword. That is instead of specifying in which "subtree" The region of interest lies, to specify how deeply nested it actually is. For example

function(something(nice(check(data))))

inner 1 argument 1 should select

nice(check(data))

inner 2 argument 1 should select

check(data)

etc... if a plain inner is used, then the behavior should be to select the innermost one.

Nonetheless, these can be Not trivial In how tie-breaking and adjective_decoding should take place

Single line compounds raise syntax error if they are followed by a keyword

Description

It seems that after single-line compounds, and additional dummy name is added Cause and syntax errors if it is followed by keyword like return or pass. As you can see below assignments are okay!

Your Code

def function():
	if x: return 0
	if x: pass
	if :
		return 1
def function():
	if x: y=4
	x=5

Repair Output

 def function():
	if x:the_dummy_name_is_really_dummy return 0
	if x:the_dummy_name_is_really_dummy pass
	if the_dummy_name_is_really_dummy :
		return 1
def function():
	if x: y=4
	x=5

Idea: utilize color as positional description

f the motivation behind this idea is to even further reduce the penalty caused by not getting the result as the main suggestion but instead as one of the color highlighted alternatives. In those cases, if users want to grab a smaller piece of the region in question two steps are required

  • select the alternative via something like smart blue

  • Keep going normally to Pickup for instance an argument

With this change, users will be able to To do that in a Singly go saying something like blue argument 3

This is going to begin with argument queries, but is going to expand to include Probably dedicated sub indexing queries and definitely small ROI queries. A point in question is where should we stop? for example who would Be worth it to support something like blue inside argument 1?

Commands Do not work when the file ends with a syntax error and there is no newline

Description

bug4

General Information

Plug-In Version: v0.1.2

Queries Affected

  • Argument

  • Big Roi

  • Sub Indexing

    • only dedicated Subindexing commands
    • also affect suffixes
  • Operations

    • Paste
    • Delete
    • Swap
    • Edit
    • Prefix
  • Collections

Response To Command

  • the command fails/nothing happens at all

  • the command select/operates on a wrong result,

    • that did not match your positional description (e.g. grabs an ROI one line above or below the one you wanted)
    • did not match the type of result you are looking for(e.g. you wanted an assertion message but you got assertion condition)
    • or maybe the result was of the correct type and position but it was selected improperly(e.g. you asked for the parameter list of function but the last parameter was not selected)
    • or maybe things are working fine when trying to select a region as a whole but start breaking when you try access smaller pieces of it
    • or perhaps the command did find the correct result but perhaps the alternatives included regions they should not or vice versa. (for instance because the command searched the entire code instead of just the current function or vice versa)
  • somehow the whole preserving the current state(alternatives,origin,initial_origin and so on) was messed up by the command! For instance,

    • track was lost of initial originand things were pasted back onto the wrong position
    • alternatives were changed when they were supposed not to!(for instance prefix operations are not supposed to do this)
  • the command seems to select/operates on a random result

  • the command has some other unintended behavior

Context In Which It Appears

Does the problem seem to appear or disappear only some of the time? Does there seem to be

  • spatial context/correlation with the cursor? for instance

    • is it affected by adjustments to the cursor position?()
    • does it make a difference whether you have selected some text or not?
    • does the problem appear only when you're going in one direction?
    • does it have to only do with multiple cursors?
    • or perhaps when switching back-and-forth between single and multiple cursors?
  • a temporal context?

    • does it appear only right after selection query was executed?
    • does it appear only if no one other selection query was executed since the last edit?
    • does it appear only after executing an operation(paste,delete,swap)?
    • does it appear when you perform manual editing between commands?
  • correlation with a pattern in the code? Such a pattern might be structural, sometimes lexical,in some cases even some piece of incomplete code that was not handled properly. A strong indicator for such a case when introducing small changes to the code has things from working perfectly into breaking. In case you have identified(or you have any suspicion about) this pattern(or maybe patterns), does the error occure when it appears

    • on the target of the query? (For instance there was a bug at some point that sometimes prevented you from selecting arguments from function calls inside with statements)
    • on the origin of the query?
    • in between them perhaps?
    • somewhere inside to the current function/class/indentation block/...
    • anywhere in the code :)

Error Message

  • error message appears in a pop-up

  • an exception trace back is printed in the sublime console(Ctrl + `)

  • the command fails silently

Problem with argument and subindexing queries In decorators when The beginning of the line Or all of it is selected

Description

Okay this is quite a critical bug, it prevents picking up arguments from function calls inside decorators When the cursor is at the beginning of the line or the entire line you selected. Unfortunately, due to the way the above/below/up/down Is implemented it is also affected And I should not have missed this… Dedicated sub indexing queries are also affected, but big ROI aren't!

bug11

It should not be confused with #17 , Because what is actually going on here Is that the origin node becomes ast.ClassDef instead of the decorator.

General Information

Plug-In Version:

Queries Affected

  • Argument

  • Big Roi

  • Sub Indexing

    • only dedicated Subindexing commands
    • also affect suffixes
  • Operations

    • Paste
    • Delete
    • Swap
    • Edit
    • Prefix
  • Collections

Response To Command

  • the command fails/nothing happens at all

  • the command select/operates on a wrong result,

    • that did not match your positional description (e.g. grabs an ROI one line above or below the one you wanted)
    • did not match the type of result you are looking for(e.g. you wanted an assertion message but you got assertion condition)
    • or maybe the result was of the correct type and position but it was selected improperly(e.g. you asked for the parameter list of function but the last parameter was not selected)
    • or maybe things are working fine when trying to select a region as a whole but start breaking when you try access smaller pieces of it
    • or perhaps the command did find the correct result but perhaps the alternatives included regions they should not or vice versa. (for instance because the command searched the entire code instead of just the current function or vice versa)
  • somehow the whole preserving the current state(alternatives,origin,initial_origin and so on) was messed up by the command! For instance,

    • track was lost of initial originand things were pasted back onto the wrong position
    • alternatives were changed when they were supposed not to!(for instance prefix operations are not supposed to do this)
  • the command seems to select/operates on a random result

  • the command has some other unintended behavior

Context In Which It Appears

Does the problem seem to appear or disappear only some of the time? Does there seem to be

  • spatial context/correlation with the cursor? for instance

    • is it affected by adjustments to the cursor position?()
    • does it make a difference whether you have selected some text or not?
    • does the problem appear only when you're going in one direction?
    • does it have to only do with multiple cursors?
    • or perhaps when switching back-and-forth between single and multiple cursors?
  • a temporal context?

    • does it appear only right after selection query was executed?
    • does it appear only if no one other selection query was executed since the last edit?
    • does it appear only after executing an operation(paste,delete,swap)?
    • does it appear when you perform manual editing between commands?
  • correlation with a pattern in the code? Such a pattern might be structural, sometimes lexical,in some cases even some piece of incomplete code that was not handled properly. A strong indicator for such a case when introducing small changes to the code has things from working perfectly into breaking. In case you have identified(or you have any suspicion about) this pattern(or maybe patterns), does the error occure when it appears

    • on the target of the query? (For instance there was a bug at some point that sometimes prevented you from selecting arguments from function calls inside with statements)
    • on the origin of the query?
    • in between them perhaps?
    • somewhere inside to the current function/class/indentation block/...
    • anywhere in the code :)

Error Message

  • error message appears in a pop-up

  • an exception trace back is printed in the sublime console(Ctrl + `)

  • the command fails silently

Idea: add support for selecting all the arguments from function call

as of release 0.1.2 the bids you can extract from a function call are

"(argument <argument_index>|keyword <keyword_index>|keyword value <keyword_value_index>|entire keyword <entire_keyword_index>|<caller> [<sub_index>]|entire call)"

which provides for a lot of options ( including going to empty function calls ) but one thing that is currently missing is the ability to select all of the arguments in function call.

Now my first idea was to utilize a name like argument list which would also make it similar to parameter list. However I believe something like arguments all might better off,i feel it might sound better with a small expansion have in mind

In particular there have been times where I have been interested in selecting only the positional arguments or the one passed by keyword, so having something like positional all and keywords all would also make sense! However, there are a couple of issues involved keyword is traditionally used for picking up only the keyword name, which might be a source of confusion, especially if you take into account that the natural expansion would be to support picking up all the keyword names or keyword values. in order to support the latter, small modifications would have to be made to the backend similar to the ones in the dedicated sub indexing queries to allow for multiple results per input because keyword names are going to be separated from one another

Problem with selecting decorators and base class

Description

General Information

Plug-In Version: v0.1.2 , develop

Queries Affected

  • Argument

  • Big Roi

  • Sub Indexing

    • only dedicated Subindexing commands
    • also affect suffixes
  • Operations

    • Paste
    • Delete
    • Swap
    • Edit
    • Prefix
  • Collections

decorator and base class can sometimes be not selected at all! argument inside decorators can also not be selected unless we are already inside the decorator, dedicated subindexing commands work!

Response To Command

  • the command fails/nothing happens at all

  • the command select/operates on a wrong result,

    • that did not match your positional description (e.g. grabs an ROI one line above or below the one you wanted)
    • did not match the type of result you are looking for(e.g. you wanted an assertion message but you got assertion condition)
    • or maybe the result was of the correct type and position but it was selected improperly(e.g. you asked for the parameter list of function but the last parameter was not selected)
    • or maybe things are working fine when trying to select a region as a whole but start breaking when you try access smaller pieces of it
    • or perhaps the command did find the correct result but perhaps the alternatives included regions they should not or vice versa. (for instance because the command searched the entire code instead of just the current function or vice versa)
  • somehow the whole preserving the current state(alternatives,origin,initial_origin and so on) was messed up by the command! For instance,

    • track was lost of initial originand things were pasted back onto the wrong position
    • alternatives were changed when they were supposed not to!(for instance prefix operations are not supposed to do this)
  • the command seems to select/operates on a random result

  • the command has some other unintended behavior

Context In Which It Appears

Does the problem seem to appear or disappear only some of the time? Does there seem to be

  • spatial context/correlation with the cursor? for instance

    • is it affected by adjustments to the cursor position?()
    • does it make a difference whether you have selected some text or not?
    • does the problem appear only when you're going in one direction?
    • does it have to only do with multiple cursors?
    • or perhaps when switching back-and-forth between single and multiple cursors?
  • a temporal context?

    • does it appear only right after selection query was executed?
    • does it appear only if no one other selection query was executed since the last edit?
    • does it appear only after executing an operation(paste,delete,swap)?
    • does it appear when you perform manual editing between commands?
  • correlation with a pattern in the code? Such a pattern might be structural, sometimes lexical,in some cases even some piece of incomplete code that was not handled properly. A strong indicator for such a case when introducing small changes to the code has things from working perfectly into breaking. In case you have identified(or you have any suspicion about) this pattern(or maybe patterns), does the error occure when it appears

    • on the target of the query? (For instance there was a bug at some point that sometimes prevented you from selecting arguments from function calls inside with statements)
    • on the origin of the query?
    • in between them perhaps?
    • somewhere inside to the current function/class/indentation block/...
    • anywhere in the code :)

code snippet when things are working

@mark_as_snippet_grammar
class MarkdownSnippets(MappingRule):
    pronunciation = "sublime snippet"
    mapping = {
        "<snippet>":
            R(Snippet("%(snippet)s")),
        "<snippet_variants> [<n>]":
            R(Snippet("%(snippet_variants)s")),
    }

Code snippet where things are not working

@mark_as_snippet_grammar(big_big_stream = "beautiful")
class CppSnippetMoreExampleExperimental(MappingRule):
    pronunciation = "sublime snippet"
    mapping = {
        "<snippet>":
            R(Snippet("%(snippet)s")),
        "<snippet_variants> [<n>]":
            R(Snippet("%(snippet_variants)s")),
        "<big_big_stream> <thing> [<n>] [with <delimiter>]":
            R(Snippet(lambda stream,thing,n,delimiter:
                stream[0] + stream[1].format(delimiter).join([thing(x) for x in range(1,n + 1)]) + stream[2]
                ,remap_data = {"big_big_stream":"stream"})
            ),
    }

With a little bit of experimenting, it seems that removing the argument from the decorator has no effect where is removing the third dictionary value with the lambda solves the problem!

It should be noted, that for selecting the decorator or the base class positional description or point of origin seem to have no effect, whereas for argument queries, things are actually working if we are already within the function call! also dedicated sub index and commands work fine!

Error Message

  • error message appears in a pop-up

  • an exception trace back is printed in the sublime console(Ctrl + `)

  • the command fails silently

Traceback (most recent call last):
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\application\application.py", line 76, in respond_to_query
    s(view_information,query_description,extra)
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\queries\abstract\selection_query.py", line 80, in __call__
    self.result ,self.alternatives = self.handle_single(view_information,query_description, extra)
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\queries\big_roi.py", line 30, in handle_single
    return  possibilities[f](view_information,query_description, extra)
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\queries\big_roi.py", line 171, in case_one
    candidates = tiebreak_on_lca(definition_node,origin,find_all_nodes(definition_node, selector = selector))
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\library\traverse.py", line 31, in find_all_nodes
    return sorted([node  for node in reachable(root) if node_wanted(node) and hasattr(node,"first_token")],
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\library\traverse.py", line 31, in <listcomp>
    return sorted([node  for node in reachable(root) if node_wanted(node) and hasattr(node,"first_token")],
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\queries\big_roi.py", line 170, in <lambda>
    selector = lambda x:match_node(x,targets,exclusions) and generic_fix(x,build[1])
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\library\info.py", line 1187, in generic_fix
    fixer(root,atok)
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\library\info.py", line 1040, in fix_argument_list
    if already_fixed(root) or fix_definition(root.parent,atok):
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\library\info.py", line 1078, in fix_definition
    token = atok.find_token(token,tokenize.NAME,i.arg)
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\third_party\asttokens\asttokens.py", line 164, in find_token
    while not match_token(t, tok_type, tok_str) and not token.ISEOF(t.type):
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\third_party\asttokens\util.py", line 47, in match_token
    return token.type == tok_type and (tok_str is None or token.string == tok_str)
AttributeError: 'NoneType' object has no attribute 'type'

Subl Path Blunder

With many thanks to @LexiconCode for pointing this out in private chat!

The communication between the main plugin and the grammar happens via the sublime command line interface through the subl executable. Up to and including version 0.1.1, it was expected that this executable is in your Windows path but the corresponding documentation was missing! That was a big blunder on my part and may have prevented you from using the project altogether! My sincerest apologies!

now you can find more information about how you can add this executable to the Windows path here, but in order to work around this issue without adding an additional installation step for you, release 0.1.2 will implement the following scheme:

  • If subl is already in the path, it will use normally

  • Otherwise, it will try to fall back to C:\Program Files\Sublime Text 3\subl which is where it should be if you have installed sublime in the classical way! In such a case, no extra steps are needed on your part!

if sublime is installed in another directory, you must unfortunately add it to the path yourself!

Please note that this does not affect Linux!

Modify backend code to allow for completely crossing out an adjective strategy

Currently via means of the reestablish_priority function In queries/utility It is possible To To change the priority With which the various strategies for adjectives of descriptions produce results. However, at the moment there is no support for completely ignoring one of those strategies, which is something that needs to be done In order to accommodate for an upcoming class of small regions of interest such as entry To pick up Deeper Within tuples,set,list under consideration

Alternative AST tool

http://tree-sitter.github.io/tree-sitter/

This is an incremental AST parsing tool used by atom for its parsing. It may solve some of your AST parsing problems you hinted at in the plug-in description.

I was saying very excited by this development, and it may even get me to buy a sublime license :-)

Off by one error big ROI queries when going upwards at the boundaries between functions

Description

The problem seems to appear only Off the boundaries between functions or right at the end of the file In a way similar to #19

bug6

And cause problems if you're trying to select something of the same type is the last statement in the above function. However, other statements in the global scope can also be affected

bug5

General Information

Plug-In Version:

Queries Affected

  • Argument

  • Big Roi

  • Sub Indexing

    • only dedicated Subindexing commands
    • also affect suffixes
  • Operations

    • Paste
    • Delete
    • Swap
    • Edit
    • Prefix
  • Collections

Response To Command

  • the command fails/nothing happens at all

  • the command select/operates on a wrong result,

    • that did not match your positional description (e.g. grabs an ROI one line above or below the one you wanted)
    • did not match the type of result you are looking for(e.g. you wanted an assertion message but you got assertion condition)
    • or maybe the result was of the correct type and position but it was selected improperly(e.g. you asked for the parameter list of function but the last parameter was not selected)
    • or maybe things are working fine when trying to select a region as a whole but start breaking when you try access smaller pieces of it
    • or perhaps the command did find the correct result but perhaps the alternatives included regions they should not or vice versa. (for instance because the command searched the entire code instead of just the current function or vice versa)
  • somehow the whole preserving the current state(alternatives,origin,initial_origin and so on) was messed up by the command! For instance,

    • track was lost of initial originand things were pasted back onto the wrong position
    • alternatives were changed when they were supposed not to!(for instance prefix operations are not supposed to do this)
  • the command seems to select/operates on a random result

  • the command has some other unintended behavior

Context In Which It Appears

Does the problem seem to appear or disappear only some of the time? Does there seem to be

  • spatial context/correlation with the cursor? for instance

    • is it affected by adjustments to the cursor position?()
    • does it make a difference whether you have selected some text or not?
    • does the problem appear only when you're going in one direction?
    • does it have to only do with multiple cursors?
    • or perhaps when switching back-and-forth between single and multiple cursors?
  • a temporal context?

    • does it appear only right after selection query was executed?
    • does it appear only if no one other selection query was executed since the last edit?
    • does it appear only after executing an operation(paste,delete,swap)?
    • does it appear when you perform manual editing between commands?
  • correlation with a pattern in the code? Such a pattern might be structural, sometimes lexical,in some cases even some piece of incomplete code that was not handled properly. A strong indicator for such a case when introducing small changes to the code has things from working perfectly into breaking. In case you have identified(or you have any suspicion about) this pattern(or maybe patterns), does the error occure when it appears

    • on the target of the query? (For instance there was a bug at some point that sometimes prevented you from selecting arguments from function calls inside with statements)
    • on the origin of the query?
    • in between them perhaps?
    • somewhere inside to the current function/class/indentation block/...
    • anywhere in the code :)

Error Message

  • error message appears in a pop-up

  • an exception trace back is printed in the sublime console(Ctrl + `)

  • the command fails silently

Permanent installation thread

I have been thinking about opening up this issue for quite a while,not sure if it will really be helpful but there it goes:) My intention is to leave this open so as to make discussing about installation easier. So if you have any questions or you are facing any sort of issues regarding installation, feel free to let me know by posting here!

In general, it is recommended that you use the latest version, namely 0.0.4 which has been tested against 0.5, 0.6, 1.1 versions of Caster , both in Windows and in Linux ( though there are a couple of technicalities regarding 1.1 version Aenea). if you decide to give it a try with the no above branch, please note that the backend code is behind master and you should only copy the 0.6 bundle to the appropriate Caster directory, the backend code on master is compatible with either bundles. Unless something critical comes up and needs urgent patching, the next version will be 0.1.0

Commands fail when the cursor is at the end of the file/after the code

Description

Pretty much what the title says:) When the cursor to the bottom of the file, selection queries don't work:) This has to do with the way the AST node is obtained from the cursor position and has been annoying me for quite a while but never got around to fixing it, so I am opening up this issue as a motivation to get it done before 0.1.3

General Information

Plug-In Version: v0.1.2 but essentially all of them are probably affected

Queries Affected

  • Argument

  • Big Roi

  • Sub Indexing

    • only dedicated Subindexing commands
    • also affect suffixes
  • Operations

    • Paste
    • Delete
    • Swap
    • Edit
    • Prefix
  • Collections

Response To Command

  • the command fails/nothing happens at all

  • the command select/operates on a wrong result,

    • that did not match your positional description (e.g. grabs an ROI one line above or below the one you wanted)
    • did not match the type of result you are looking for(e.g. you wanted an assertion message but you got assertion condition)
    • or maybe the result was of the correct type and position but it was selected improperly(e.g. you asked for the parameter list of function but the last parameter was not selected)
    • or maybe things are working fine when trying to select a region as a whole but start breaking when you try access smaller pieces of it
    • or perhaps the command did find the correct result but perhaps the alternatives included regions they should not or vice versa. (for instance because the command searched the entire code instead of just the current function or vice versa)
  • somehow the whole preserving the current state(alternatives,origin,initial_origin and so on) was messed up by the command! For instance,

    • track was lost of initial originand things were pasted back onto the wrong position
    • alternatives were changed when they were supposed not to!(for instance prefix operations are not supposed to do this)
  • the command seems to select/operates on a random result

  • the command has some other unintended behavior

Context In Which It Appears

Does the problem seem to appear or disappear only some of the time? Does there seem to be

  • spatial context/correlation with the cursor? for instance

    • is it affected by adjustments to the cursor position?()
    • does it make a difference whether you have selected some text or not?
    • does the problem appear only when you're going in one direction?
    • does it have to only do with multiple cursors?
    • or perhaps when switching back-and-forth between single and multiple cursors?
  • a temporal context?

    • does it appear only right after selection query was executed?
    • does it appear only if no one other selection query was executed since the last edit?
    • does it appear only after executing an operation(paste,delete,swap)?
    • does it appear when you perform manual editing between commands?
  • correlation with a pattern in the code? Such a pattern might be structural, sometimes lexical,in some cases even some piece of incomplete code that was not handled properly. A strong indicator for such a case when introducing small changes to the code has things from working perfectly into breaking. In case you have identified(or you have any suspicion about) this pattern(or maybe patterns), does the error occure when it appears

    • on the target of the query? (For instance there was a bug at some point that sometimes prevented you from selecting arguments from function calls inside with statements)
    • on the origin of the query?
    • in between them perhaps?
    • somewhere inside to the current function/class/indentation block/...
    • anywhere in the code :)

Error Message

  • error message appears in a pop-up

  • an exception trace back is printed in the sublime console(Ctrl + `)

  • the command fails silently

Need to fix encoding issues that cause the pop-up for reporting errors to users to crash

Occasionally when trying to report errors, some encoding issue happens in the pop up either does not appear or appears without the information it should have. The console Is also often polluted with stuff like

Parse Error: #x27;NoneType&#x27; object has no attribute &#x27;string&#x27;</p> code: Unexpected character
Parse Error: 27;NoneType&#x27; object has no attribute &#x27;string&#x27;</p> code: Unexpected character
Parse Error: 7;NoneType&#x27; object has no attribute &#x27;string&#x27;</p> code: Unexpected character
Parse Error: #x27; code: Unknown entity
Parse Error: #x27; object has no attribute &#x27;string&#x27;</p> code: Unexpected character
Parse Error: 27; object has no attribute &#x27;string&#x27;</p> code: Unexpected character
Parse Error: 7; object has no attribute &#x27;string&#x27;</p> code: Unexpected character
Parse Error: #x27; code: Unknown entity
Parse Error: #x27;string&#x27;</p> code: Unexpected character
Parse Error: 27;string&#x27;</p> code: Unexpected character
Parse Error: 7;string&#x27;</p> code: Unexpected character
Parse Error: #x27; code: Unknown entity
Parse Error: #x27;</p> code: Unexpected character
Parse Error: 27;</p> code: Unexpected character
Parse Error: 7;</p> code: Unexpected character
Parse Error: #x27; code: Unknown entity

Need to fix this at some point

Subindexing strings that contain " or ' fails If surrounded by ' or " respectively

Description

General Information

Plug-In Version: v0.1.2,develop, probably the entire 0.1.x Is affected

Queries Affected

  • Argument

  • Big Roi

  • Sub Indexing

    • only dedicated Subindexing commands
    • also affect suffixes
  • Operations

    • Paste
    • Delete
    • Swap
    • Edit
    • Prefix
  • Collections

picking up parts of certain types of strings fails! this also causes commands of the for smart string 2 to fail if problematic strings are within the search space

Response To Command

  • the command fails/nothing happens at all

  • the command select/operates on a wrong result,

    • that did not match your positional description (e.g. grabs an ROI one line above or below the one you wanted)
    • did not match the type of result you are looking for(e.g. you wanted an assertion message but you got assertion condition)
    • or maybe the result was of the correct type and position but it was selected improperly(e.g. you asked for the parameter list of function but the last parameter was not selected)
    • or maybe things are working fine when trying to select a region as a whole but start breaking when you try access smaller pieces of it
    • or perhaps the command did find the correct result but perhaps the alternatives included regions they should not or vice versa. (for instance because the command searched the entire code instead of just the current function or vice versa)
  • somehow the whole preserving the current state(alternatives,origin,initial_origin and so on) was messed up by the command! For instance,

    • track was lost of initial originand things were pasted back onto the wrong position
    • alternatives were changed when they were supposed not to!(for instance prefix operations are not supposed to do this)
  • the command seems to select/operates on a random result

  • the command has some other unintended behavior

Context In Which It Appears

Does the problem seem to appear or disappear only some of the time? Does there seem to be

  • spatial context/correlation with the cursor? for instance

    • is it affected by adjustments to the cursor position?()
    • does it make a difference whether you have selected some text or not?
    • does the problem appear only when you're going in one direction?
    • does it have to only do with multiple cursors?
    • or perhaps when switching back-and-forth between single and multiple cursors?
  • a temporal context?

    • does it appear only right after selection query was executed?
    • does it appear only if no one other selection query was executed since the last edit?
    • does it appear only after executing an operation(paste,delete,swap)?
    • does it appear when you perform manual editing between commands?
  • correlation with a pattern in the code? Such a pattern might be structural, sometimes lexical,in some cases even some piece of incomplete code that was not handled properly. A strong indicator for such a case when introducing small changes to the code has things from working perfectly into breaking. In case you have identified(or you have any suspicion about) this pattern(or maybe patterns), does the error occure when it appears

    • on the target of the query? (For instance there was a bug at some point that sometimes prevented you from selecting arguments from function calls inside with statements)
    • on the origin of the query?
    • in between them perhaps?
    • somewhere inside to the current function/class/indentation block/...
    • anywhere in the code :)

it seems that it does not like at all, when " or ' are inside a string that is surrounded by '," respectively

'" "'
"'b'"
"Bob's"
"\"ab\'"

even if they are escaped. In contrast these actually works

"\"ab\""
"\"ab"
'a\'b'

the same applies for triple quoted strings as well!

'''a\"b'''

Error Message

  • error message appears in a pop-up

  • an exception trace back is printed in the sublime console(Ctrl + `)

  • the command fails silently

Traceback (most recent call last):
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\application\application.py", line 76, in respond_to_query
    s(view_information,query_description,extra)
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\queries\abstract\selection_query.py", line 80, in __call__
    self.result ,self.alternatives = self.handle_single(view_information,query_description, extra)
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\queries\select_part.py", line 41, in handle_single
    result = get_sub_index(second_origin,query_description["sub_index"]-1)
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\library\info.py", line 764, in get_sub_index
    candidates = get_subparts_of_string(root)
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\library\info.py", line 674, in get_subparts_of_string
    z = mean(y1,y2)
NameError: global name 'mean' is not defined

Rework Subscript ROIs

  • Rename subscript key to index, in order to free up key for dictionaries

  • Clarify behavior for empty upper/lower/step

  • add left,middle,right for picking up from chains Like data[x][y][z] and as well as something to pick up the "pure subscript body

  • handle better edge cases with extra dimensions. For instance, when you have multiple slices and indices mixed together

Argument queries Inside exception handlers fail when The exception name is selected

Description

Related to #20 but different

If the exception name is selected then queries inside the exception handler are going to fail silently. it does not seem to affect Cases when you select something above or below

bug3

General Information

Plug-In Version:

Queries Affected

  • Argument

  • Big Roi

  • Sub Indexing

    • only dedicated Subindexing commands
    • also affect suffixes
  • Operations

    • Paste
    • Delete
    • Swap
    • Edit
    • Prefix
  • Collections

Response To Command

  • the command fails/nothing happens at all

  • the command select/operates on a wrong result,

    • that did not match your positional description (e.g. grabs an ROI one line above or below the one you wanted)
    • did not match the type of result you are looking for(e.g. you wanted an assertion message but you got assertion condition)
    • or maybe the result was of the correct type and position but it was selected improperly(e.g. you asked for the parameter list of function but the last parameter was not selected)
    • or maybe things are working fine when trying to select a region as a whole but start breaking when you try access smaller pieces of it
    • or perhaps the command did find the correct result but perhaps the alternatives included regions they should not or vice versa. (for instance because the command searched the entire code instead of just the current function or vice versa)
  • somehow the whole preserving the current state(alternatives,origin,initial_origin and so on) was messed up by the command! For instance,

    • track was lost of initial originand things were pasted back onto the wrong position
    • alternatives were changed when they were supposed not to!(for instance prefix operations are not supposed to do this)
  • the command seems to select/operates on a random result

  • the command has some other unintended behavior

Context In Which It Appears

Does the problem seem to appear or disappear only some of the time? Does there seem to be

  • spatial context/correlation with the cursor? for instance

    • is it affected by adjustments to the cursor position?()
    • does it make a difference whether you have selected some text or not?
    • does the problem appear only when you're going in one direction?
    • does it have to only do with multiple cursors?
    • or perhaps when switching back-and-forth between single and multiple cursors?
  • a temporal context?

    • does it appear only right after selection query was executed?
    • does it appear only if no one other selection query was executed since the last edit?
    • does it appear only after executing an operation(paste,delete,swap)?
    • does it appear when you perform manual editing between commands?
  • correlation with a pattern in the code? Such a pattern might be structural, sometimes lexical,in some cases even some piece of incomplete code that was not handled properly. A strong indicator for such a case when introducing small changes to the code has things from working perfectly into breaking. In case you have identified(or you have any suspicion about) this pattern(or maybe patterns), does the error occure when it appears

    • on the target of the query? (For instance there was a bug at some point that sometimes prevented you from selecting arguments from function calls inside with statements)
    • on the origin of the query?
    • in between them perhaps?
    • somewhere inside to the current function/class/indentation block/...
    • anywhere in the code :)

As stated above the problem appears when the exception name is selected, however after a failed attempt queries can start failingEven when the selection is a single point instead of range!

Error Message

  • error message appears in a pop-up

  • an exception trace back is printed in the sublime console(Ctrl + `)

  • the command fails silently

Handle trailing combinations of subscripts attributes and function calls

In general, the fact that we can perceive Code both in a linear format( the way appears as text ) and as a tree( they way it is presented in AST) can result in situations where deciding how a given expression can be split into smaller ones can be difficult.One such occasion are trailing combination of subscripts,attributes and function calls

something[0].hello("world")[1].data["address"]

Support for allowing a more linear approach For such scenarios Should be added

Investigate: Add copy action

While in general simply selecting a region and then using default Caster stoosh [<n>] Is very handy and flexible scenes since You can choose which slot do you want to fill , having a quick copy action might not be that bad. Nonetheless, there are a few important questions

  • Should these be implemented in the backned or from within the grammar?

  • should the text the user wants Be selected or not?

  • Behavior with multiple cursors?

  • Showing alternatives?

Unsatisfying LCA tie-breaking inside dictionaries, Need to bind keyvalue pairs stronger together

When launching simple query without any positional information like argument 1 or smart iterable Inside a dictionary, results from the neighborhood of the keyvalue pair you are currently in Are prioritized. However, Depending on the code the main result May not come from the current keyvalue pair You are currently in (for example your cursor is inside of the key and you want something in the value) but from the Neighboring upwards instead! simply compare those two examples

bug12

Of course things work correctly In those cases, If a positional description like down argument 1 is used by the This is satisfying

Argument leak in exception handlers

Description

When the origin is inside an exemption handler, argument queries "leak", that these instead of only searching within the exception handler, They search the entire blockWhich is not the intended behavior

bug2

General Information

Plug-In Version: v 0.1.2

Queries Affected

  • Argument

  • Big Roi

  • Sub Indexing

    • only dedicated Subindexing commands
    • also affect suffixes
  • Operations

    • Paste
    • Delete
    • Swap
    • Edit
    • Prefix
  • Collections

Response To Command

  • the command fails/nothing happens at all

  • the command select/operates on a wrong result,

    • that did not match your positional description (e.g. grabs an ROI one line above or below the one you wanted)
    • did not match the type of result you are looking for(e.g. you wanted an assertion message but you got assertion condition)
    • or maybe the result was of the correct type and position but it was selected improperly(e.g. you asked for the parameter list of function but the last parameter was not selected)
    • or maybe things are working fine when trying to select a region as a whole but start breaking when you try access smaller pieces of it
    • or perhaps the command did find the correct result but perhaps the alternatives included regions they should not or vice versa. (for instance because the command searched the entire code instead of just the current function or vice versa)
  • somehow the whole preserving the current state(alternatives,origin,initial_origin and so on) was messed up by the command! For instance,

    • track was lost of initial originand things were pasted back onto the wrong position
    • alternatives were changed when they were supposed not to!(for instance prefix operations are not supposed to do this)
  • the command seems to select/operates on a random result

  • the command has some other unintended behavior

Context In Which It Appears

Does the problem seem to appear or disappear only some of the time? Does there seem to be

  • spatial context/correlation with the cursor? for instance

    • is it affected by adjustments to the cursor position?()
    • does it make a difference whether you have selected some text or not?
    • does the problem appear only when you're going in one direction?
    • does it have to only do with multiple cursors?
    • or perhaps when switching back-and-forth between single and multiple cursors?
  • a temporal context?

    • does it appear only right after selection query was executed?
    • does it appear only if no one other selection query was executed since the last edit?
    • does it appear only after executing an operation(paste,delete,swap)?
    • does it appear when you perform manual editing between commands?
  • correlation with a pattern in the code? Such a pattern might be structural, sometimes lexical,in some cases even some piece of incomplete code that was not handled properly. A strong indicator for such a case when introducing small changes to the code has things from working perfectly into breaking. In case you have identified(or you have any suspicion about) this pattern(or maybe patterns), does the error occure when it appears

    • on the target of the query? (For instance there was a bug at some point that sometimes prevented you from selecting arguments from function calls inside with statements)
    • on the origin of the query?
    • in between them perhaps?
    • somewhere inside to the current function/class/indentation block/...
    • anywhere in the code :)

Error Message

  • error message appears in a pop-up

  • an exception trace back is printed in the sublime console(Ctrl + `)

  • the command fails silently

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.