Want to create a dynamic in-line element per parameter in a function #3971
Unanswered
kim12345678a
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
hello everyone,
I am creating a custom IDE (for Typescript) where I want to meet the following requirement:
When some functions (with placeholder for each parameter) are summoned via snippets, per parameter, there should be a button.
The buttons will be gone when the user deletes the placeholder or the parameter.
The button should behave as the color css:
Here is an example to illustrate the requirement:
Suppose there's a function called
Example
. There are two parameters: num and browserType. browserType is an enum and it has 3 values: Edge, Chrome, Firefox.When user summons
Example
via snippet, editor will displayExample( <button>num, <button>browsertype )
. When you press the button for num, a dropdown will appear below with a slider. It will replace 'num' with 0. Adjusting the slider will change the parameter value. When you press the button for browserType, a dropdown will appear below with a list of Edge, Chrome, and Firefox. Clicking the value will replace what was in the parameter with the newly selected value.I have done some research and I just want to validate if my high-level approach is correct and get some feedback on this approach. OR if there's a better way of doing this:
my super-light prototype in the monaco-editor playground
Ultimately I do want to programmatically add snippets, so I will need to access the snippet controller.
the
<b>
is there to indicate that I want replace with the button.To create the button that will show the dropdown, I will need to make a component that implements icontentwidget . The component will have a reference to the editor so that
onDidChangeModelContent
). By listening to text changes, I write some conditions to check whether to remove itself or not- if a drop down is a slider , any changes in the slider will update the parameter
- if a drop down is a list, whichever value is selected will update the parameter
I could either create the dropdown in the DomNode of the IcontentWidget OR I can make an IOverlayWidget for that dropdown
Thank you in advance for your feedback and thoughts
Beta Was this translation helpful? Give feedback.
All reactions