vscode-kafka icon indicating copy to clipboard operation
vscode-kafka copied to clipboard

POC with output consumer.

Open angelozerr opened this issue 4 years ago • 7 comments

POC with output consumer.

Signed-off-by: azerr [email protected]

angelozerr avatar Dec 18 '20 13:12 angelozerr

This draft PR replaces the consumer view editor with the vscode standard output channel. Here a little demo:

ConsumerOutoutDemo

  • pros for using Output

    • performant: don't need to store the whole buffer of the logs. https://github.com/jlandersen/vscode-kafka/blob/e2f0b8f893a0866540ea32b1633100eb54823b63/src/providers/consumerVirtualTextDocumentProvider.ts#L6implements vscode.TextDocumentContentProvider which requires to store the full text of the consumer log. When a new log is inserted, the internal buffer is growing up and the text editor is replaced with a large text content although it should just insert at the end the new log text. It causes performance problem too with TextMate syntax highlighting because it highlights the full document instead of applying syntax highlighting only for the inserted log.
    • provide clean console button out of the box, in other words, it fixes https://github.com/jlandersen/vscode-kafka/issues/40
    • provide scroll lock, in other words, it fixes https://github.com/jlandersen/vscode-kafka/issues/44
    • provide search feature which I think is very interesting.
  • cons for Output

    • we cannot add custom action like start/stop consumer
    • when you start several consumer you cannot see them in the same time (with editor you have not this problem).
    • syntax highlighting cannot be done for a custom language with a custom TextMate. I mean that Output can be highlighted but for the all output. But it exists an issue for this support in https://github.com/microsoft/vscode/issues/11005 (which is closed but not implemented, I suppose that we need to vote).

angelozerr avatar Dec 18 '20 14:12 angelozerr

@jlandersen @fbricon what do you think about using output instead of using editor (like today) to display Kafka consumer messages?

angelozerr avatar Dec 19 '20 15:12 angelozerr

@angelozerr I originally considered Output first when I implemented consumers but went for the current approach due to specifically not being able to add custom actions as you write.

I am not against adding support for using Output instead, but there should be improvements to managing consumers as well - perhaps a separate node in the sidebar with active consumers (I'd probably want this in the future anyways, regardless of whether consumer output is kept as a text document).

jlandersen avatar Dec 20 '20 07:12 jlandersen

due to specifically not being able to add custom actions as you write.

Ok thanks for your feedback.

I am not against adding support for using Output instead, but there should be improvements to managing consumers as well - perhaps a separate node in the sidebar with active consumers

Ok I will study your idea;

(I'd probably want this in the future anyways, regardless of whether consumer output is kept as a text document).

@jlandersen what do you think about supporting both output and text document with a settings?

angelozerr avatar Dec 21 '20 20:12 angelozerr

due to specifically not being able to add custom actions as you write.

Ok thanks for your feedback.

I am not against adding support for using Output instead, but there should be improvements to managing consumers as well - perhaps a separate node in the sidebar with active consumers

Ok I will study your idea;

(I'd probably want this in the future anyways, regardless of whether consumer output is kept as a text document).

@jlandersen what do you think about supporting both output and text document with a settings?

I'm definitely open for it :)

jlandersen avatar Jan 03 '21 18:01 jlandersen

I'm definitely open for it :)

Thanks for your feedback! @fbricon what do you think about that?

angelozerr avatar Jan 04 '21 15:01 angelozerr

We can do that, but we can go even further. If virtual doc is being used, detect if we reach a buffer threshold and then advise the user to switch to the console

fbricon avatar Jan 05 '21 09:01 fbricon