Skip to content

Add APIs for enabling CompileOnSave on tsserver#9837

Merged
zhengbli merged 28 commits into
microsoft:tsserverVS-WIPfrom
zhengbli:compileOnSave0
Aug 23, 2016
Merged

Add APIs for enabling CompileOnSave on tsserver#9837
zhengbli merged 28 commits into
microsoft:tsserverVS-WIPfrom
zhengbli:compileOnSave0

Conversation

@zhengbli

Copy link
Copy Markdown

Added two APIs to enable "Compile On Save" on tsserver:

  • CompileOnSaveAffectedFileList: returns the list of files that need to be saved and recompiled due to the current changes. The editor can use this list to queue up files to compile and prompt the user with options of saving the files / checking out the files from source control etc.
  • CompileFile: writes the emit output of a single file to the file system.

@zhengbli zhengbli changed the title Add two APIs for enabling CompileOnSave on tsserver WIP: Add two APIs for enabling CompileOnSave on tsserver Jul 27, 2016
@zhengbli zhengbli changed the title WIP: Add two APIs for enabling CompileOnSave on tsserver WIP: Add APIs for enabling CompileOnSave on tsserver Jul 27, 2016
@zhengbli zhengbli changed the title WIP: Add APIs for enabling CompileOnSave on tsserver Add APIs for enabling CompileOnSave on tsserver Jul 29, 2016
Comment thread src/compiler/core.ts Outdated
return undefined;
}

export function findFirst<T>(array: T[], predicate: (item: T) => boolean): T {

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.

forEach has pretty much the same semantics

zhengbli added 3 commits August 14, 2016 01:20
Use Path type for internal file name matching and simplifying builder logic
Also move the CompileOnSave option out of compilerOptions
Comment thread src/compiler/commandLineParser.ts Outdated
if (!hasProperty(jsonOption, "compileOnSave")) {
return false;
}
const result = convertJsonOption({ name: "compileOnSave", type: "boolean" }, jsonOption["compileOnSave"], basePath, errors);

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.

extract { name: "compileOnSave", type: "boolean" } into a variable so it can be used here and in commandLineParser.ts

}
}

export function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean {

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.

hasProperty(jsonOption, compileOnSaveCommandLineOption.name)

Comment thread src/server/builder.ts Outdated
return;
}

if (array.length === 1 && array[0] === fileInfo) {

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.

you can do splice only if array[0] === fileInfo otherwise just exit

@zhengbli zhengbli merged commit a082857 into microsoft:tsserverVS-WIP Aug 23, 2016
@zhengbli zhengbli deleted the compileOnSave0 branch August 23, 2016 23:20
@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.

3 participants