Vscode-live-server: Use more specific `activationEvents`

Created on 2 Jul 2017  路  17Comments  路  Source: ritwickdey/vscode-live-server

This extension is activated all the time. As a result, the status bar item is always visible.

I think we can use multiple activationEvents like "workspaceContains: **/*.html", "workspaceContains: _config.yml" and something else.

closed enhancement

All 17 comments

First, _Thanks You Very Much for the suggestion._

yep, you're right. that should not be activated if there are no HTML file in work-space. Because this is meaning less.

okay! I have changed activationEvents to "workspaceContains:**/*.html", "onLanguage:html".

I think, we should not block activationEvents for onCommand:extension.liveServer.goOnline.

In case if anyone wants to start a server for a unknown reason......... :p .......

馃榿

Another small suggestion 馃槈.
It seems that vscode extensions are usually named in the format of vscode-lowercase-name.
Personally I think it looks better than name of mixed upper and lower case chars.

This is a picture from the vscode official iteration plan

image

Sorry! I don't understand. Did you mean about the naming convention of git repo?

Yes, the name of git repo ...

okay. I got that. I'll update that tonight 馃憤

I updated the name. Is that okay?

Now it's perfect

okay! I got another issue. workspaceContains checks also node_modules. Can I exclude it?

馃槷

It supports glob patterns. You can try !node_modules/**/*.

If it doesn't work, maybe we should open a vscode issue. (And this is the original PR)

workspaceContains:**/*.html", "workspaceContains:!node_modules/**/*,

even if I write this, extension will be activated because of the first line.

I would suggest that we should stop using **/*.html, it's too general. And that means we require there is at least a HTML file in the root folder.

We can add more patterns for common web project structure later

but if we don't use **/*.html , then it will show every time.

I guess that's because you still have !node_modules/**/* 馃槼

I mean

"activationEvents": [
    "workspaceContains:*.html",
    "onLanguage:html",
    "onCommand:extension.liveServer.goOnline",
    "onCommand:extension.liveServer.goOffline"
]

"workspaceContains:*.html", => that will not work for sub folders.

Anyway, I am able to restrict that by code. :)

馃憣

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ninlil picture ninlil  路  6Comments

tehsy97 picture tehsy97  路  6Comments

maboumra picture maboumra  路  3Comments

abhiinos111abhi picture abhiinos111abhi  路  5Comments

Er-rchydy picture Er-rchydy  路  3Comments