Skip to content
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

Support services settings #22236

Merged
13 commits merged into from
Mar 20, 2018
Prev Previous commit
Next Next commit
Merge branch 'master' into services_settings
  • Loading branch information
Andy Hanson committed Mar 12, 2018
commit 940979a2a3433b0f821c419aab14fb943b0ad33d
2 changes: 1 addition & 1 deletion src/harness/fourslash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2522,7 +2522,7 @@ Actual: ${stringify(fullActual)}`);
* @param fileName Path to file where error should be retrieved from.
*/
private getCodeFixes(fileName: string, errorCode?: number, options: ts.Options = ts.defaultOptions): ts.CodeFixAction[] {
const diagnosticsForCodeFix = this.getDiagnostics(fileName).map(diagnostic => ({
const diagnosticsForCodeFix = this.getDiagnostics(fileName, /*includeSuggestions*/ true).map(diagnostic => ({
start: diagnostic.start,
length: diagnostic.length,
code: diagnostic.code
Expand Down
1 change: 1 addition & 0 deletions src/server/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2645,6 +2645,7 @@ namespace ts.server.protocol {
* For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`.
*/
readonly includeCompletionsWithInsertText?: boolean;
readonly importModuleSpecifierPreference?: "relative" | "baseUrl";
Copy link
Member

Choose a reason for hiding this comment

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

We should reconsider if we want to call this something like "non-relative" just because most of the time, people are using this with path-mapping; but I think it really depends on the behavior. If we always give completions from the baseUrl (probably undesirable) then we can keep this as baseUrl. But if we already have this, it's probably fine. @mhegazy @sheetalkamat

}

export interface CompilerOptions {
Expand Down
2 changes: 1 addition & 1 deletion src/services/codefixes/importFixes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ namespace ts.codefix {
}

const relativePath = removeExtensionAndIndexPostFix(getRelativePath(moduleFileName, sourceDirectory, getCanonicalFileName), compilerOptions, addJsExtension);
if (!baseUrl || options.importModuleSpecifierPreference == "relative") {
if (!baseUrl || options.importModuleSpecifierPreference === "relative") {
return [relativePath];
}

Expand Down
2 changes: 1 addition & 1 deletion src/services/shims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ namespace ts {
return this.forwardJSONCall(
`getCompletionEntryDetails('${fileName}', ${position}, '${entryName}')`,
() => {
const localOptions: ts.FormatCodeOptions = formatOptions === undefined ? undefined : JSON.parse(formatOptions);
const localOptions: FormatCodeOptions = formatOptions === undefined ? undefined : JSON.parse(formatOptions);
return this.languageService.getCompletionEntryDetails(fileName, position, entryName, localOptions, source, options);
}
);
Expand Down
4 changes: 3 additions & 1 deletion tests/baselines/reference/api/tsserverlibrary.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4069,6 +4069,7 @@ declare namespace ts {
readonly quote?: "double" | "single";
readonly includeCompletionsForModuleExports?: boolean;
readonly includeCompletionsWithInsertText?: boolean;
readonly importModuleSpecifierPreference?: "relative" | "baseUrl";
}
interface LanguageService {
cleanupSemanticCache(): void;
Expand Down Expand Up @@ -7110,6 +7111,7 @@ declare namespace ts.server.protocol {
* For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`.
*/
readonly includeCompletionsWithInsertText?: boolean;
readonly importModuleSpecifierPreference?: "relative" | "baseUrl";
}
interface CompilerOptions {
allowJs?: boolean;
Expand Down Expand Up @@ -7901,7 +7903,7 @@ declare namespace ts.server {
private updateProjectIfDirty(project);
getFormatCodeOptions(file: NormalizedPath): FormatCodeSettings;
getOptions(file: NormalizedPath): Options;
private onSourceFileChanged(fileName, eventKind);
private onSourceFileChanged(fileName, eventKind, path);
private handleDeletedFile(info);
private onConfigChangedForConfiguredProject(project, eventKind);
/**
Expand Down
1 change: 1 addition & 0 deletions tests/baselines/reference/api/typescript.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4321,6 +4321,7 @@ declare namespace ts {
readonly quote?: "double" | "single";
readonly includeCompletionsForModuleExports?: boolean;
readonly includeCompletionsWithInsertText?: boolean;
readonly importModuleSpecifierPreference?: "relative" | "baseUrl";
}
interface LanguageService {
cleanupSemanticCache(): void;
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.