-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
Module augmentation seems to break entirely a class definition/body IntelliSense autocomplete. Debug failure (exception on executing command "completionInfo"). #58907
Labels
Milestone
Comments
/// <reference path="fourslash.ts" />
// @module: nodenext
// @Filename: /node_modules/@sapphire/pieces/index.d.ts
//// interface Container {
//// stores: unknown;
//// }
////
//// declare class Piece {
//// get container(): Container;
//// }
////
//// declare class AliasPiece extends Piece {}
////
//// export { AliasPiece, type Container };
// @Filename: /node_modules/@sapphire/framework/index.d.ts
//// import { AliasPiece } from "@sapphire/pieces";
////
//// declare class Command extends AliasPiece {}
////
//// declare module "@sapphire/pieces" {
//// interface Container {
//// client: unknown;
//// }
//// }
////
//// export { Command };
// @Filename: /index.ts
//// import "@sapphire/pieces";
//// import { Command } from "@sapphire/framework";
//// class PingCommand extends Command {
//// /*1*/
//// }
const preferences = {
includeCompletionsWithClassMemberSnippets: true,
includeCompletionsWithInsertText: true,
};
verify.completions({
marker: "1",
includes: [
{
name: "container",
insertText: "get container(): Container {\n}",
filterText: "container",
hasAction: true,
source: "ClassMemberSnippet/",
},
],
preferences,
isNewIdentifierLocation: true,
});
verify.applyCodeActionFromCompletion("1", {
name: "container",
source: "ClassMemberSnippet/",
description: `Includes imports of types referenced by 'container'`,
newFileContent: `import "@sapphire/pieces";
import { Command } from "@sapphire/framework";
import { Container } from "@sapphire/pieces";
class PingCommand extends Command {
}`,
preferences,
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🔎 Search Terms
"debug failure completionInfo", "module augmentation breaks autocomplete classes"
🕗 Version & Regression Information
completionInfo
debug failure, or classes IntelliSense autocomplete.@sapphire/framework
module types seems to not work below TypeScript 4.⏯ Playground Link
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAIgCbAM4GNpIHQCtUIDcAUKJLHAN5wDCEIIAhgHZJwC+cAZlPYgAKpGYMAAtgUAKYB6HoxCSA7tADWRYsXQAbRqlRwACsGYBzOgxZtJADxiTW+801ZVicd3GnTDUvXADaNAAqAEoAMnAA1HAAygYAgjQAogC6cDAQcKiSknCMAK4ZmOBaknbYcACS8NmSIPoZcMpQKnAQzFoAnnDGcEGdYJIx6FDAYPBgOp0mvPmsADRwAEaFPVxwnRD56VDdMOL6QgpZ6PaMo5m9AGoxdEiS824eXumi9j01OfXpmcwQNaIIIo8sxuggnJYEHBtLp9Ap9hAkPoAGRwMC8QawYCSVCLFbwYAArZaHBPdzEdhAA
💻 Code
@sapphire/framework
package, will explain why in additional information about the issue.🙁 Actual behavior
In VSCode, pressing
CTRL + SPACE
inside the class definition doesn't show the extended class methods & properties, but it should, as it works with any other extended class.typescript@next
and this issue still happens.node_module
lib).🙂 Expected behavior
VSCode should've shown in the IntelliSense autocomplete the extended class methods & properties, as it seems to do so in the TypeScript playground.
Additional information about the issue
The
Command
class in the@sapphire/framework
package extends a lot of classes; following a hierarchy, goes like this:Command
extendsAliasPiece
,AliasPiece
extendsPiece
.If I remove in the
AliasPiece
class the extendingPiece
class, then the autocomplete seems to work as expected, therefore, we can assume that there's something in thePiece
class that's causing the issue. And there is.The
![image](https://private-user-images.githubusercontent.com/133937431/340512554-8bce7233-c5f6-4fd3-9f28-e6e9a5d7dcfb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2ODUwNzEsIm5iZiI6MTcxOTY4NDc3MSwicGF0aCI6Ii8xMzM5Mzc0MzEvMzQwNTEyNTU0LThiY2U3MjMzLWM1ZjYtNGZkMy05ZjI4LWU2ZTlhNWQ3ZGNmYi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYyOVQxODEyNTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xZjk1YzBiYTQ2MTVhYmY0OGI2YzAyNjdjZThkMTA4MmE4ZjRkNjUzYjBiNDllNmE1YTk5MzZlM2Q0NzNmODYxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.2w3h8SVifMg07EaSbIfwPbB5qqZ5tRQr38oVLJJu1o4)
Piece
command has a get accessor calledcontainer
that has the type ofContainer
.This
![image](https://private-user-images.githubusercontent.com/133937431/340513055-47e71130-fc2f-4038-85c4-43f572912494.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2ODUwNzEsIm5iZiI6MTcxOTY4NDc3MSwicGF0aCI6Ii8xMzM5Mzc0MzEvMzQwNTEzMDU1LTQ3ZTcxMTMwLWZjMmYtNDAzOC04NWM0LTQzZjU3MjkxMjQ5NC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYyOVQxODEyNTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT03YmMzNDFhYWNjNzYyMTAxMDM0OTcxNmY5ZmRlNDYxY2EwNjAwNDJiMzU4NjJlYmQyNWE0NThkOGNmYTkxMzUyJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.dgJ7HdtriHnIGffjW_L_fyRbYjabcnkonI7I6nDf4B0)
Container
type (to be specific, interface) has the following body:The
![image](https://private-user-images.githubusercontent.com/133937431/340513414-0f03eb86-1a7b-4792-b660-c86b0258e32d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2ODUwNzEsIm5iZiI6MTcxOTY4NDc3MSwicGF0aCI6Ii8xMzM5Mzc0MzEvMzQwNTEzNDE0LTBmMDNlYjg2LTFhN2ItNDc5Mi1iNjYwLWM4NmIwMjU4ZTMyZC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYyOVQxODEyNTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yZWM1NzAwNmE5NDM5MjI2YzIwN2I0ZTk5Y2MyY2UwNWU1OGZkMGNhOTM2OGRiOTkzMmY4NjNiZGMxNzRjZmQ1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.3YOSQHMNsN16yRa0O0y4EoK1NiGGr8P87O5g7O7B5TM)
Container
type is located in the@sapphire/pieces
package. However, if we continue looking, we can see that the@sapphire/framework
package types does module augmentation to thatContainer
type:Deleting that
Container
interface in the module augmentation seems to fix the issue with the autocomplete (but obviously, we don't want to delete that interface as it is important to use module augmentation in this case).Therefore, I came with the conclusion that maybe this could be an issue with module augmentation feature.
I took a look at logs and couldn't find anything related to module augmentation, but at least there's an error that happens exactly when I do
CTRL + SPACE
in the class definition, specifying that this is a "debug failure"? Unsure how TypeScript server works behind the scenes, but what I find weird is that this works in TypeScript playground and not in VSCode...The text was updated successfully, but these errors were encountered: