Skip to content

Conversation

zhengbli
Copy link
Contributor

Return the path of the config file and the file name list of the project (optionally). This is helpful in differentiate the build command behavior for loose files and configured projects in sublime.

Return the path of the config file and the file name list of the project
(optionally). This is helpful in differentiate the build command
behavior for loose files and configured projects in sublime.
export var TypeDefinition = "typeDefinition";
export var SignatureHelp = "signatureHelp";
export var TypeDefinition = "typeDefinition";
export var ProjectInfo = "projectInfo";
export var Unknown = "unknown";
Copy link
Member

Choose a reason for hiding this comment

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

I know it's an orthogonal change, but can you make these all consts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is the gain in doing that?

Copy link
Member

Choose a reason for hiding this comment

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

These are constants, they should be communicated as such :)

Also, it is generally good practice to mark things immutable when possible anyhow.

@zhengbli
Copy link
Contributor Author

@mhegazy could you take a look?

/**
* Indicate if the file name list of the project is needed
*/
needFileNameList: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the scenario where you only want the config file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I try to build, I only need to know if the current project is a configured project or inferred one; and for configured project, I only need to know the path of the config file. Therefore the file list is not needed.

@mhegazy
Copy link
Contributor

mhegazy commented Jun 1, 2015

Can we add some tests as well. we will need some new fourslash infrastructure to get this going.. i can help out if you want.

fileNameList?: string[];
}

export interface ProjectInfoResponse extends Response {
Copy link
Contributor

Choose a reason for hiding this comment

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

comment this interface.

@mhegazy
Copy link
Contributor

mhegazy commented Jun 2, 2015

LGTM, just a few comments, and a couple more tests needed.

zhengbli added a commit that referenced this pull request Jun 2, 2015
Add APIs to provide project info for a given file
@zhengbli zhengbli merged commit ea2c9e8 into microsoft:master Jun 2, 2015
expected.join(","),
actual.fileNameList.map( file => {
return file.replace(this.basePath + "/", "")
}).join(",")
Copy link
Member

Choose a reason for hiding this comment

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

Is the list of files always guaranteed to be in a certain order? As you just join the list and compare the string without sorting, this test may be fragile if the order ever changes. May want to sort first.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is intended because @mhegazy told me that the sequence of the files is important too, so we should also check if the sequence matches expected.

Copy link
Contributor

Choose a reason for hiding this comment

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

File order matter, it should be the reference/import resolution order or the order of files in tsconfig.

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants