-
Notifications
You must be signed in to change notification settings - Fork 326
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
Quick Fix Import Button #12051
Quick Fix Import Button #12051
Conversation
🧪 Storybook is successfully deployed!📊 Dashboard:
|
Let's start with following source code: from Standard.Base import all
main =
file1 = Standard.Table.Row.Row
file2 = Row
node1 = Standard.Microsoft.Main by default all three nodes yield an error: The However there is another The source code gets a new from Standard.Base import all
import Standard.Table
import Standard.Microsoft
main =
file1 = Standard.Table.Row.Row
file2 = Row
node1 = Standard.Microsoft.Main |
app/gui/src/project-view/components/GraphEditor/GraphNodeMessage.vue
Outdated
Show resolved
Hide resolved
app/gui/src/project-view/components/GraphEditor/GraphNodeMessage.vue
Outdated
Show resolved
Hide resolved
|
||
const props = defineProps<{ | ||
message: string | ||
type: MessageType | ||
}>() | ||
|
||
function containsLibraryName(): string | null { | ||
const prefix = 'Compile error: Fully qualified name references a library ' |
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.
Isn't this message somewhere as constant? Seems a bit dangerous to hardcode it like this.
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.
It may be a constant, but in Java code. We don't have a way to share constants between Java and JavaScript. However you are right. This is slightly fragile, in the long run we could try:
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.
Let's enhance the language server protocol we have. For example let's extend Diagnostic with possible hints, like:
hint: {
type: "import",
add: "Standard.Table"
}
that way we would formalize this API - would be better in the long run then depending on the text of the message.
The fix import button continues to "fix import" even when latest develop branch was merged in.
Can I merge? Before today's demo? |
For unit testing, the code needs to be a bit refactored... But I think they're not needed, as this is easy party and will be overhauled at some point (to not use hard-coded message, for example). But before merging, see my comment |
Green enough. Let's get this in and claim a cooperation success. |
Pull Request Description
Based on the ideas presented in the #12019 discussion this PR introduces a quick fix button capable of automatically adding the missing
import
statement when a fully qualified name is used without a library being imported.Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
TypeScript,