Skip to content

Add API support for LS host to specify script kind of a file to open#7954

Merged
zhengbli merged 2 commits into
microsoft:masterfrom
zhengbli:supportScriptKindOnServer
Apr 19, 2016
Merged

Add API support for LS host to specify script kind of a file to open#7954
zhengbli merged 2 commits into
microsoft:masterfrom
zhengbli:supportScriptKindOnServer

Conversation

@zhengbli

@zhengbli zhengbli commented Apr 8, 2016

Copy link
Copy Markdown

Fixes #7291 and #7720

Comment thread src/server/protocol.d.ts Outdated
* Used to specify the script kind of the file explicitly. It could be one of the following:
* ".ts", ".js", ".tsx", ".jsx"
*/
scriptKindName?: string;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i would keep this insync with ScriptKind. so JS, JSX, TS, TSX.

also i would use string literal types, now that we have them instead of string. so:

scriptKindName?: "JS" | "JSX" | "TS" | "TSX";

@mhegazy

mhegazy commented Apr 19, 2016

Copy link
Copy Markdown
Contributor

👍 with comments on the values of the scriptkind in the protocol.

Comment thread src/server/session.ts
break;
case "JSX":
scriptKind = ScriptKind.JSX;
break;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be like scriptKind = ScriptKind[openArgs.scriptKindName] ?

I mean how many places will you need to touch if you create a new ScriptKind? You want to make it less error-prone.

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

4 participants