-
Notifications
You must be signed in to change notification settings - Fork 62
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
VSCODE-231: Catch completion error when not connected #251
VSCODE-231: Catch completion error when not connected #251
Conversation
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.
nice, since we are updating a bunch of dependencies we manually test this a good bit before release. Especially playgrounds. Couple comments, not blockers, mostly on types and definitions.
Nice job adding more types and reducing any
usage.
src/language/mongoDBService.ts
Outdated
_cachedCollections: object; | ||
_cachedShellSymbols: any; | ||
_connectionOptions?: NodeOptions; | ||
_cachedDatabases: CompletionItem[] | []; |
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.
Maybe we can make this _cachedDatabases: CompletionItem[] = []
and remove the setting in the constructor. Same with _cachedFields
and _cachedCollections
src/utils/types.ts
Outdated
@@ -25,3 +26,29 @@ export type CloudInfoResult = { | |||
isGcp: boolean; | |||
isAzure: boolean; | |||
}; | |||
|
|||
export type NodeOptions = { |
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 we already have a place where it might make sense for this to live: https://github.com/mongodb-js/vscode/blob/master/src/connectionModelType.ts#L5
Kind of an aside, how do you feel about having a folder for these types, so instead of utils/types.ts
it's types/CollectionItem.ts
ortypes/ConnectionModel.ts
.
With connection model maybe we can even go further and similar to how we treat .less
files: https://github.com/mongodb-js/vscode/blob/master/src/views/webview-app/externals.ts but in this case we can define the mongodb-connection-model
we can create a type definition for that module and use that. Maybe that's a different part of work from this though we can do later. (Maybe we don't bother if we want to have our own connection model in this repo also).
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.
Nice
Are DocumentSource
, InstanceInfoResult
, and cloudInfoType
only used for telemetry? maybe they file can exist in the telemetry folder?
Tried to repro the error - looks like its handled nicely now 👍
@Anemy I have noticed that when types are stored in separate folders with time some of them become needed for other modules, but you don't remember already that these types exist and duplicate them. when all types stored in one folder it is easier to navigate and manage them. but I am open to discussion and finding a better way to deal with it. |
Description
any
with proper types in the language server.https://jira.mongodb.org/browse/VSCODE-231
Checklist
Motivation and Context
Types of changes