I am trying to write a VS Code plugin to extend the functionality of Emmet. The desired outcome is that when the user presses the Tab key, if the Tab key triggers an Emmet expansion or a code snippet, it should not perform any additional actions. If it does not trigger any special functions, it should use my custom logic. Additionally, if the cursor is in a placeholder within an expanded snippet, the Tab key should have the special function of navigating the cursor, and in this case, it should not use the custom logic either.
I am currently encountering three problems:
- How can I determine if the Tab key will trigger an Emmet expansion or a code snippet?
- How can I determine if the cursor is currently in a placeholder within a code snippet when the Tab key is pressed?
- If I intercept the Tab key, how can I trigger the default behavior of the Tab key in my code logic?
These are all the issues I have. I know that if I give up using the Tab key to trigger the functionality, the problems will become much simpler, but using the Tab key is a perfect idea, so modifying the premise of using the Tab key to trigger is not considered in the question.