-
Notifications
You must be signed in to change notification settings - Fork 0
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
Recognize crate plugin dependencies #208
base: main
Are you sure you want to change the base?
Conversation
eb2d8ce
to
659c827
Compare
58c95c5
to
f6fa869
Compare
a1a6506
to
639396f
Compare
98cc352
to
321bd50
Compare
Please don't merge until we have the metadata changes on main |
src/project/builtin_plugins.rs
Outdated
|
||
let package_name = &plugin_metadata.package.repr; | ||
|
||
if package_name.contains("assert_macros") { |
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.
Why .contains()
instead of regular ==
? We can make true here on package like assert_macros_but_better
, don't we?
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.
package_name
stores a serialized name, containing the version and source. For assert_macros
, it is assert_macros 2.9.2 (std)
. That's why this method checks whether the plugin is built in and then whether its name .contains
the important part. Alternatively, we can tokenize those names and use ==
as you suggested, or use regular expression matching.
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.
That's fine, but please comment on this at least.
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.
Sure, I added an explanation
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.
Now that I think about it maybe regex is indeed better xD
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.
// The package discriminator has form: "<name> <version> (<source>)".
So maybe .starts_with("<name> ")
(note space
after name)?
You will not catch it in the source and it can be arbitrary link.
c43464a
to
c161fce
Compare
let package_discriminator = &plugin_metadata.package.repr; | ||
|
||
// Check if the discriminator refers to a known built-in plugin package. | ||
if package_discriminator.contains("assert_macros") { |
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.
do at least this
if package_discriminator.contains("assert_macros") { | |
if package_discriminator.starts_with("assert_macros ") { |
this will be immune to packages having this keyword in their source part
but I think to be entirely sure, you should not inspect the ID, but look for package metadata instead and do ==
equality over package name + possibly whitelist source
c161fce
to
48c6c86
Compare
f6fa869
to
cf91f9b
Compare
@@ -58,7 +58,7 @@ lsp-server = "0.7.8" | |||
lsp-types = "=0.95.0" | |||
memchr = "2.7.4" | |||
salsa = { package = "rust-analyzer-salsa", version = "0.17.0-pre.6" } | |||
scarb-metadata = "1.13" | |||
scarb-metadata = { git = "https://github.com/software-mansion/scarb", branch = "spr/main/ac416d0e" } # TODO: Change back to crates-io as soon as changes from that branch are released there |
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.
Blocking until these changes are indeed released. I don't want to fall into trap when Cairo 2.10 is released and we don't have this fixed yet
commit-id:a1e078b6
commit-id:fa144cb1
cf91f9b
to
61468b9
Compare
48c6c86
to
c90354f
Compare
Stack: