-
Notifications
You must be signed in to change notification settings - Fork 121
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
Sublime snippets first part #775
base: master
Are you sure you want to change the base?
Sublime snippets first part #775
Conversation
This contains the basic code generates the text, inserte it, Maintain a snippet state, as well as dragonfly actions to wrap things up
…of function I hope this solves the deprecation errors that Appear in the checks
I accidentally put this comment in the wrong place with my previous commit
Nice Work, if I'm feeling better will test this tomorrow. I have a few thoughts regarding the structure of the the modules you've included. Historically many things were stored in Broadly speaking application grammars and supporting grammars are paired with their supporting functions in a
Functionally what this does is separate the grammars in the core code of Caster. Its a WIP as I'm still working on re-factoring's a few things out of the core code back into grammars and supporting files. In order for the override system for the user directory to work you will need to place conditional imports in the code. These imports try to import locally first (user directory), then from source code.
Not ideal my opinion but will work until we get a better system in place for support files. |
Thank you very much for your feedback! Polluting the Firstly, the main usage of the supporting functions is most likely going to be in user made grammars. Even the control grammar is here to support such custom grammars. As a consequence, conditional imports are going to be needed note only in the code that we ship by default but kinda everywhere in order to avoid inconsistencies or things breaking. Secondly,even though the current functionality can be wrapped up inside a single file without losing too much readability, I'm not sure sure that this will be the case forever, for instance if we port and more advanced version of . More importantly, if the community finds these features beneficial, it might also make sense to provide at some point utilities that could make writing more complex snippets even easier and faster, such as voice commands ( Either way I think I might be needlessly overthinking this potential issue and I will start by placing everything inside |
…pted values fails this was actually causing problem when dealing with lists but the solution should be more general
…iple times if module is reloaded
It turns out that my feeling of conditional imports could be error-prone If used incorrectly was correct after all and unfortunately I found about it the hard way:) All those conditionally imports never enter there except clause because all the vscode_rules,sublime_rules, are in the sys.path!!! so they're not necessary as they're not doing anything:D
But with my current implementation, If a user grammar Forgot the conditional import and imported directly with the long |
Oh interesting, I knew that core code was added to path. So the reason the conditional imports exist is all is for the user directory. I would've not predicted it would have issues in the source code receiving two modules because the imports come from the same place. As you figure it out could you describe the methodology are using to test this and the issues you're seeing. I'd like to be able to get to a place where I can help you troubleshoot this. From my understanding I'll try to restate your issue. The original file is already added to the sys path. When the conditional import is called it's except clause is never reached because the relative import is always true. The end result may be there's two instances of the module being referenced which may not be a identical. The only time the relative import is not true is that the user does not copy the entire folder breaking the relative imports.
Are you using a debugger? if not I can help you get that set up, attaching to a process or or a remote debugger. |
…he controlled grammar
…somewhat similar manner to Key
I think this is a good move, so the question then becomes what happened to the grammar somehow becomes invalidated when refreshing? we could hold its previous state and a singleton and update that singleton when the rule is successfully validated.
Feel free to use whatever medium you would like. Gifs could be stored in the local repository. I've recently gained control over the caster YouTube channel. I have a few things to figure out yet but that could be used as well for video hosting. |
24ab020
to
88a91bd
Compare
Title
Sublime snippets first part
Description
This is part one of an attempt to integrate https://github.com/mpourmpoulis/CasterSublimeSnippetInterfaceExample into Caster
@LexiconCode I know this is a busy period For you so fear not as this is not ready to merge! There are quite a feat few things that need to be taken care off, documentation to be written and improvements to be made and will gradually get round to it over the next week. This is just a preliminary a PR For testing purposes And to make providing feedback easier.
In a nutshell these pull requests contains
Files under the lib folder that handle the various tasks needed for implementing the desired functionality,such as
Interfacing with sublime
generate the the actual snippet text
maintaining a snippet state
much of the above functionality is exposed via the dragonfly custom actions
Snippet,SnippetVariant,SnippetTransform,DisplaySnippetVariants
Which you can import fromcastervoice.lib.sublime_snippets
a global control grammar,with which currently does not have much( mainly the commonly used
variant <n>
, so you do have not to define it everywhere) in which we enable bysublime snippet control
( to be improved)But there are some improvements as well Like Snippet lambda can receive more arguments
And something to be the more juicy,which I want to eventually fully integrate in the control grammar But will need work
Related Issue
Motivation and Context
Say goodbye to .sublime-snippet files
How Has This Been Tested
Tested locally on Windows, need more people to test
Types of changes
Checklist
Maintainer/Reviewer Checklist