-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Sandcastle helper snippets #12679
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
Sandcastle helper snippets #12679
Conversation
Thank you for the pull request, @jjspace! ✅ We can confirm we have a CLA on file for you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a look at this. I cannot say much about the "code level", except that specifying the return type could make sense: void
for setSnippets
and
function createDependencyProposals(range: Range) : languages.CompletionItem[]
Just for additional documentation/type safety.
I also tried it out with different configurations, and it seems that it works as expected.
And... yeah ... it's me again...
documentation: "Create a Sancastle button",
should be
documentation: "Create a Sandcastle button",
😁
(in all documentation
fields)
Thanks for taking a look @javagl! I added some types to help.
I have a few typing quirks I can't seem to shake, like often typing |
@@ -112,6 +114,79 @@ function SandcastleEditor({ | |||
); | |||
} | |||
|
|||
function createDependencyProposals(range: Range): languages.CompletionItem[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we move the snippets to their own file?
label: "scbutton", | ||
kind: languages.CompletionItemKind.Function, | ||
documentation: "Create a Sandcastle button", | ||
insertText: `Sandcastle.addToolbarButton(\${1:"New Button"}, function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does the ${1:"New Button"}
syntax come from? I've never seen it before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This syntax is for the various "tab stops" to make filling data easier. I can look for monaco specific documentation but I mostly referred to the VSCode snippets docs which I've used for snippets a bunch in the past https://code.visualstudio.com/docs/editing/userdefinedsnippets
@ggetz I moved the snippet setup to it's own file quickly while cleaning up some branches. This should be good to go now I think but no rush |
Thanks @jjspace! We may wan to take a pass on which snippets to include and so forth as we do a final polish, but looking good overall. |
Description
I have long wanted to include some sort of "code helpers" for adding common chunks of code to sandcastle. Currently these exist as dedicated buttons in the new Sandcastle but I'm not sure they will stay that way in the final UI. These are mostly for more "power users" so I've taken a pass at implementing these as snippets directly in monaco. These can always be expanded later.
scbutton
will generate the button codesctoggle
will generate the checkmark toggle button codescmenu
andscmenuitem
will generate code for the dropdown menus.All of these snippets have tab stops to make it quick an easy to input the labels, variables and your code.
Based on the monaco code completion example
Issue number and link
Part of #12566
Testing plan
npm run dev
in the package ornpm run build-sandcastle && npm star
at top level)Author checklist
CONTRIBUTORS.md
CHANGES.md
with a short summary of my change