clarkio / vscode-twitch-highlighter

This is a VS Code extension that will allow your Twitch chat to highlight a line of code via a command message. Example: `!line 8 server.js`. See master branch README.md for more details
https://clarkio.com
203 stars 14 forks source link

Composable Extensions #61

Open clarkio opened 5 years ago

clarkio commented 5 years ago

It would be nice to break out components within this extension (such as the twitch chat listener component) into their own extension to allow other extensions to depend upon it and interact with it.

This would allow us to do things like letting the Highlighter UI display highlights regardless of which streaming platform chat system is connected.

parithon commented 5 years ago

With this in mind, should we rename the repo? I liked your description on stream, vscode-line-highlighter.

clarkio commented 5 years ago

Yes we'll need to do some significant refactoring to pull this off I think.

I've been looking into how the Azure suite of VS Code extensions work since there's a main extension "Azure Account" and then other extensions depend upon it (like Azure Functions).

Here's where Azure Functions extension declares its dependency on another extension (Azure Account): https://github.com/Microsoft/vscode-azurefunctions/blob/master/package.json#L864

I've not found how it's being used yet within the Azure Functions extension at this time thought.

parithon commented 5 years ago

It appears they call commands in Azure Account from Azure Functions.

See https://github.com/Microsoft/vscode-azurefunctions/blob/03274e2bbea279cc7b68663665cfffafb8f2c7dc/src/extension.ts#L91

clarkio commented 5 years ago

Oh, nice find! I overlooked that in the code! That's great to know for understanding how to call other extension commands.

Thinking about how we could modularize this extension, it seems like breaking out the language server (Twitch chat listener) from the UI components (commands, tree view, and status bar icon) into separate extensions would be best. What do you think?

With that in mind I suppose the integration point between UI based extensions and the language server extension would be to listen to the IPC messages on the connection, right? I wonder if those .onRequest() "events" (such as 'startchat' would need to be namespaced? Or maybe we need to rethink how that language server extension is implemented.

This was me sharing some thoughts to the discussion. Let me know if you have any as well.

parithon commented 5 years ago

I was thinking about that as well and I wondered, why do we need the language server? I agree that we need to separate the UI components from the chat service components.

I was thinking we could create an interface that chat extensions (i.e. our twitch client) would implement that includes the startchat and stopchat methods. Then we would have those chat extensions register with our 'core' extension. The 'core' extension would be responsible for starting each chat service that is registered.

parithon commented 5 years ago

Removed milestone 0.2.0 since we already baked that stone...