Skip to content
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

Use more specific activationEvents #1

Closed
yzhang-gh opened this issue Jul 2, 2017 · 17 comments
Closed

Use more specific activationEvents #1

yzhang-gh opened this issue Jul 2, 2017 · 17 comments

Comments

@yzhang-gh
Copy link

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.

@ritwickdey
Copy link
Owner

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".

@ritwickdey
Copy link
Owner

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 .......

@yzhang-gh
Copy link
Author

😁

@yzhang-gh
Copy link
Author

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

@ritwickdey
Copy link
Owner

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

@yzhang-gh
Copy link
Author

Yes, the name of git repo ...

@ritwickdey
Copy link
Owner

okay. I got that. I'll update that tonight 👍

@ritwickdey
Copy link
Owner

I updated the name. Is that okay?

@yzhang-gh
Copy link
Author

Now it's perfect

@ritwickdey
Copy link
Owner

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

@yzhang-gh
Copy link
Author

😮

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)

@ritwickdey
Copy link
Owner

ritwickdey commented Jul 3, 2017

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

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

@yzhang-gh
Copy link
Author

yzhang-gh commented Jul 3, 2017

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

@ritwickdey
Copy link
Owner

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

@yzhang-gh
Copy link
Author

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"
]

@ritwickdey
Copy link
Owner

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

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

@yzhang-gh
Copy link
Author

👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants