Skip to content

Conversation

@ritwickdey
Copy link
Owner

@ritwickdey ritwickdey commented Jun 10, 2018

PR Type

What kind of change does this PR introduce?

  • Multi-root workspace support. The extension will ask the user which workspace need to be picked up.
  • No more support for single file open (without workspace).
  • New Settings multiRootWorkspaceName
  • Small refactor
[ ] Bugfix
[x] Feature
[x] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other: <!-- Please describe: -->

What is the current behavior?

Issue Number: #43

What is the new behavior?

[ ] Yes
[x] No (Though Not sure :p )

@ritwickdey ritwickdey requested a review from rjoydip-zz June 10, 2018 16:27
@ritwickdey ritwickdey changed the title Multi root Multi-root workspace support Jun 10, 2018
private haveAnySupportedFile() {
return new Promise<void>(resolve => {
const globFormat = `**/*[${SUPPRORTED_EXT.join(' | ')}]`;
workspace.findFiles(globFormat, '**/node_modules/**', 1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Configure ignore like this and pass config which is coming from settings(user settings) in below ignore array.

const ignore = [
    'build/**/*',
    'out/**/*',
    'dist/**/*',
];
const workspaceFiles = await workspace.findFiles(
    new RelativePattern(workspaceFolder, `{${ignoreWorkspace.join(',')}}`),
);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, there should be catch if something went wrong.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I don't get that.

BTW, workspace.findFiles returns Thenable<T>, we can't use await.
And haveAnySupportedFile was introduced at early stage of live server just for not to visible the status bar 'go live' button if there're no SUPPORTED file (html, svg & htm) in the workspace folder - though it's not working well.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check this microsoft/vscode#37806

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep! I was also thinking that it is a bug. Anyway, this is not the main focus - it is just about user experience that the 'Go Live' will be visible if and only there has any HTML, HTM or SVG file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's good. Go live should not visible for all types of files. It's really confusing

import { Config } from './Config';


export const workspaceResolver = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export function workspaceResolver() { /* ... */ }

import { Config } from './Config';


export const setOrChangeWorkspace = () => {
Copy link
Collaborator

@rjoydip-zz rjoydip-zz Jun 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export function setOrChangeWorkspace() { /* ... */ }

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay! I've no issue. Is there any reason that function literals is bad?

Copy link
Collaborator

@rjoydip-zz rjoydip-zz Jun 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an issue but for better readblity. You can keep as it is

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okk. okk

};


export const workspaceResolver = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export function workspaceResolver() { /* ... */ }

@ritwickdey
Copy link
Owner Author

Still, edge cases are not handled.

Copy link
Collaborator

@rjoydip-zz rjoydip-zz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it will be better to add test file under some folder and use it through path. Then it will be better for others to test. What you think?

@ritwickdey
Copy link
Owner Author

@rjoydip, yep test is now really important. But testing vscode extension is hard i think. I'll try to add tests for Helper Class. I don't know how I can test the GoLive Method or Live Server Helper class or change detection of HTML.

@rjoydip-zz
Copy link
Collaborator

rjoydip-zz commented Jun 12, 2018

I have to try. I haven't written any test cases in vscode.

@ritwickdey ritwickdey closed this Jun 14, 2018
@ritwickdey ritwickdey reopened this Jun 14, 2018
@ritwickdey
Copy link
Owner Author

I'm shipping this PR by today as I've tested almost fully (manually)...

@rjoydip-zz
Copy link
Collaborator

Yes you can ship this. LGTM

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants