-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
leap with Label #206
Comments
I love the utility of the idea. Importation would be very tricky when it comes to index number. Wouldn't the index number change any time text or function was edited? Could you expound on what you mean by that index number? This would not be hard to create using Visual Studio Code #198 because it's IDE aware. VSC has a bookmark feature which we could pair label to line position. Or If the text is highlighted it could be paired with the search function. And you could jump from each reference. For instance if there's 3 references you could jump to the 3rd. I put some more thought into it and let me know what you think there's definitely a lot of options with an API. I'm not clever enough to figure out IDE agnostic approach. |
I like the idea of visual studio code and I think something similar would be possible with many other editors with support for bookmarks. I have not used the bookmarks personally however So I will have to take a look at them. Now for my original idea. First about the index number: I was thinking that as you said updating the Index as function is edited would be very hard in an ide agnostic context, so perhaps the user Could make up for it.
In the above code example without an Index ,it would be very annoying to have to count how many labels there are between the first and The Return statement to Jump directly to The Return statement. On the contrary, the Index would make it easy to say jump 6 and get there directly.
A problem comes up if you are somewhere else in the code and you want to Jump to a label without knowing its index and its index isn't 0. For this case I think you Could use the form of the label to partially search for the label. In the above case you could look for "(^function_" and try to read the index in a way similar to the (I'm sorry for the terrible text formatting, Google Voice doesn't help very much and I have rsi) |
I am thinking about a feature to allow for quick jumping between points of interest in text or code. The principle would be to have a distinct symbols as beacons in the file so that they can be instantly reachable by an editor find. These symbols will consist of an extremely rare encapsulating string, a label and a number for grouping . It would look like <<. Label_Number .>> . This would work with 4 commands.
The
set label <text> [at index <number>]
command with set the label to a string value similarly to theset format
command. The number argument will by default be the starting index of the label to be printed. Its value will increment.The
label [here]
command will print the label at the current cursor position.The
leap [<number>]
command will jump to the currently set label which is indexed by number or to the next index, if a number is not given. The command will remember the last index it was called with. In case of a nonexistent index it will jump randomly to the first matching label. Alternatively, a history of the labels could be kept which will contain the available indexes and it could jump to the last index.A
clear labels
command which would delete all the labels in the text. (This could be messy)Another enhancement would be a self modifying rule which would have a dictionary of labels for increased accuracy. This would allow for a consistent
leap <Label_name>
command which I am hesitant to include in the original idea because with the accuracy results I have observed, I don't think it would be very usable.Uses of the Leap command
Example usage
``` def <<.Function_0.>> ( <<.Function_1.>> , <<.Function_2.>> ): <<.Function_3.>> return <<.Function_4.>> ``` This could be the definition of a function inside the Python rules file. The user could say "set label function" and use the leap command to position the cursor at the function name, the arguments and finally the return statement.I'd like to take this on after some feedback about how useful it sounds and the way it should work.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: