-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: ignore files with .liveserverignore #130
base: master
Are you sure you want to change the base?
Conversation
…ore with liveserver params
return Array.isArray(val) ? val : [val]; | ||
} | ||
|
||
private unique(_arr: Array<any>): Array<any> { |
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.
This is array unique fn is immutable. slice will create problem and more expensive(for mutability).
lib/live-server/index.js
Outdated
@@ -397,14 404,19 @@ LiveServer.start = function (options, callback) { | |||
function (testPath) { // Always ignore dotfiles (important e.g. because editor hidden temp files) | |||
return testPath !== "." && /(^[.#]|(?:__|~)$)/.test(path.basename(testPath)); | |||
}, | |||
"**/node_modules/**" | |||
"node_modules/", |
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.
node_modules/ any folder under node modules can be ignored. Just like we all do in .gitignore.
src/appModel.ts
Outdated
if (patterns.length) { | ||
params.ignore = patterns; | ||
} else { | ||
params.ignore = Config.getIgnoreFiles; |
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.
Previously Config.getIgnoreFiles wasn't attach on params
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.
Actually not.. it is attached in Helper.ts
. I agree, my code is not clean at that time. I've to refactor the code.
https://github.com/ritwickdey/vscode-live-server/blob/master/src/Helper.ts#L82
src/extension.ts
Outdated
@@ -38,5 38,6 @@ export function activate(context: ExtensionContext) { | |||
|
|||
|
|||
export function deactivate() { | |||
|
|||
const appModel = new AppModel(); |
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.
Live server shutdown when editor deactivate.
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.
Okay! Sorry for late (you know I've exam - and now finished)
anyway, just create new AppModel();
object from out the function (like a global object of the file), so that both activate
& deactivate
function can share the same instance of the AppModel
. I think it'll be better. Is not it?
Yes that's will be better. Np I will do that |
Can you please able to complete this in the weekend? |
I have fixed the requesed changes. Have you reviewed that? |
Ok, I'm testing on my local machine. |
Sorry, it's not working in my machine, even reload is working on changes in the |
Then I have to check it again |
@ritwickdey Can you tell me how you testing. It's working on here. Check again I made some changes. |
|
||
if (patterns.length) { | ||
params.ignore = patterns; | ||
} |
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.
Can you please move this code here
vscode-live-server/src/Helper.ts
Lines 79 to 84 in ae651a6
const ignorePathGlob = Config.getIgnoreFiles || []; | |
const ignoreFiles = []; | |
ignorePathGlob.forEach(ignoredPath => { | |
if (!ignoredPath.startsWith('/') || !ignoredPath.startsWith('\\')) | |
ignoreFiles.push(workspacePath path.sep ignoredPath); |
const ignorePathGlob = patterns || Config.getIgnoreFiles || [];
if (options.ignore) { | ||
ignored = ignored.concat(options.ignore); | ||
ignored.push('**/node_modules/**/*'); |
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.
It should be **/node_modules/**
. I think this is why live server responding on changes into node_module folder
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.
NP because **/node_modules/**
is equivalent with **/node_modules/**/*
b334167
to
c62e7ce
Compare
1c9fc20
to
71bc737
Compare
Description
Ignore file through
.liveserverignore
the file just like we do like.gitignore
. Only need to create a.liveserverignore
file in project root level.Fixed issue
shadow name
error inappModel > openBrowser
function.