-
Notifications
You must be signed in to change notification settings - Fork 123
feat(language-service): Support importing the external module's expor… #2173
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
"ngserver": "./bin/ngserver" | ||
}, | ||
"dependencies": { | ||
"@angular/language-service": "20.0.0-rc.2", | ||
"@angular/language-service": "^20.1.0-next.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can revert this change now (if you rebase) |
||
"vscode-html-languageservice": "^4.2.5", | ||
"vscode-jsonrpc": "6.0.0", | ||
"vscode-languageserver": "7.0.0", | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -32,6 +32,7 @@ export interface SessionOptions { | |||||
logToConsole: boolean; | ||||||
includeAutomaticOptionalChainCompletions: boolean; | ||||||
includeCompletionsWithSnippetText: boolean; | ||||||
includeCompletionsForModuleExports: boolean; | ||||||
forceStrictTemplates: boolean; | ||||||
disableBlockSyntax: boolean; | ||||||
disableLetSyntax: boolean; | ||||||
|
@@ -49,7 +50,7 @@ const EMPTY_RANGE = lsp.Range.create(0, 0, 0, 0); | |||||
const setImmediateP = promisify(setImmediate); | ||||||
|
||||||
const defaultFormatOptions: ts.FormatCodeSettings = {}; | ||||||
const defaultPreferences: ts.UserPreferences = {}; | ||||||
let defaultPreferences: ts.UserPreferences = {}; | ||||||
|
||||||
const htmlLS = getHTMLLanguageService(); | ||||||
|
||||||
|
@@ -70,6 +71,7 @@ export class Session { | |||||
private readonly openFiles = new MruTracker(); | ||||||
private readonly includeAutomaticOptionalChainCompletions: boolean; | ||||||
private readonly includeCompletionsWithSnippetText: boolean; | ||||||
private readonly includeCompletionsForModuleExports: boolean; | ||||||
private snippetSupport: boolean|undefined; | ||||||
private diagnosticsTimeout: NodeJS.Timeout|null = null; | ||||||
private isProjectLoading = false; | ||||||
|
@@ -86,8 +88,13 @@ export class Session { | |||||
this.includeAutomaticOptionalChainCompletions = | ||||||
options.includeAutomaticOptionalChainCompletions; | ||||||
this.includeCompletionsWithSnippetText = options.includeCompletionsWithSnippetText; | ||||||
this.includeCompletionsForModuleExports = options.includeCompletionsForModuleExports; | ||||||
this.logger = options.logger; | ||||||
this.logToConsole = options.logToConsole; | ||||||
defaultPreferences = { | ||||||
...defaultPreferences, | ||||||
includeCompletionsForModuleExports: options.includeCompletionsForModuleExports, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I think the absence of this option should then be With the above, should the |
||||||
}; | ||||||
// Create a connection for the server. The connection uses Node's IPC as a transport. | ||||||
this.connection = lsp.createConnection({ | ||||||
// cancelUndispatched is a "middleware" to handle all cancellation requests. | ||||||
|
@@ -150,6 +157,7 @@ export class Session { | |||||
// We don't want the AutoImportProvider projects to be created. See | ||||||
// https://devblogs.microsoft.com/typescript/announcing-typescript-4-0/#smarter-auto-imports | ||||||
includePackageJsonAutoImports: 'off', | ||||||
includeCompletionsForModuleExports: this.includeCompletionsForModuleExports, | ||||||
}, | ||||||
watchOptions: { | ||||||
// Used as watch options when not specified by user's `tsconfig`. | ||||||
|
@@ -1234,12 +1242,14 @@ export class Session { | |||||
let options: ts.GetCompletionsAtPositionOptions = {}; | ||||||
const includeCompletionsWithSnippetText = | ||||||
this.includeCompletionsWithSnippetText && this.snippetSupport; | ||||||
if (this.includeAutomaticOptionalChainCompletions || includeCompletionsWithSnippetText) { | ||||||
if (this.includeAutomaticOptionalChainCompletions || includeCompletionsWithSnippetText || | ||||||
this.includeCompletionsForModuleExports) { | ||||||
options = { | ||||||
includeAutomaticOptionalChainCompletions: this.includeAutomaticOptionalChainCompletions, | ||||||
includeCompletionsWithSnippetText: includeCompletionsWithSnippetText, | ||||||
includeCompletionsWithInsertText: | ||||||
this.includeAutomaticOptionalChainCompletions || includeCompletionsWithSnippetText, | ||||||
includeCompletionsForModuleExports: this.includeCompletionsForModuleExports, | ||||||
}; | ||||||
} | ||||||
|
||||||
|
@@ -1269,8 +1279,8 @@ export class Session { | |||||
|
||||||
const offset = lspPositionToTsPosition(scriptInfo, position); | ||||||
const details = languageService.getCompletionEntryDetails( | ||||||
filePath, offset, item.insertText ?? item.label, undefined, undefined, undefined, | ||||||
undefined); | ||||||
filePath, offset, item.insertText ?? item.label, undefined, undefined, defaultPreferences, | ||||||
data.tsData); | ||||||
if (details === undefined) { | ||||||
return item; | ||||||
} | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the name of this option is a bit misleading? If I understand correctly, it doesn't enable/disable all auto imports, just the "global" completions. Can you update this description and option name?