-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add terminal observer API #13402
Add terminal observer API #13402
Conversation
Here's the plugins and here's the source: |
Signed-off-by: Thomas Mäder <[email protected]>
3208e4c
to
e10ff8b
Compare
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.
All in all seems to work great and code looks good to me.
just something i found a little weird but i don't know if its a problem. Following console output
gitpod /workspace/theia (13085_terminal_observer) $ testx
bash: testx: command not found
gitpod /workspace/theia (13085_terminal_observer) $
having an observer with .*testx.*
for one line only prints
["gitpod /workspace/theia (13085_terminal_observer) $ testx "]```
But with two lines it prints
["gitpod /workspace/theia (13085_terminal_observer) $ testx "]
["bash: testx: command not found "]
["bash: testx: command not found "]
I would have expected for one line it would print the command not found
once and for two lines maybe twice because one for when the output is first printed and one when the input prompt is back again or none for 1 line and once for 2 lines
No, I think this is correct: the code is matching against the last n lines each time text is added to the terminal. If you type "testx", the matching will be done basically on every character you type. Since the previous line already matches |
What it does
This is a draft PR for feedback on #13085
How to test
The attached theia plugin adds two commands: "Register Observer" and "Remove Observer". The first one allows to register a terminal observer with a given name, regular expression to match and a number of lines to match. The second command unregisters obeservers registered before by name.
The registered observers write the matched strings to the Theia back end log.
Follow-ups
Review checklist
Reminder for reviewers