Skip to content

Conversation

@JanSharp
Copy link
Contributor

Specifically to prevent it from trying to match the tostring-ed numeric number keys of plain arrays with config folder paths, which can lead to false positives if those paths contain numbers and then ultimately results in only a single argument out of the arguments array being passed along

Side note, it's nice for multi plugin to be natively supported, plus separating plugin args like this. Though this is a bug where the plugin args are just an array without any separating which is only useful when there's a single plugin so I suppose it's unrelated but still thank you :D

Specifically to prevent it from trying to match the tostring-ed numeric
  number keys of plain arrays with config folder paths, which can lead
  to false positives if those paths contain numbers and then ultimately
  results in only a single argument out of the arguments array being
  passed along
@JanSharp JanSharp force-pushed the do-not-try-to-match-plugin-array-with-workspace-paths branch from 3e17047 to e21402a Compare June 18, 2024 19:47
@JanSharp
Copy link
Contributor Author

It seems I jumped the gun on making this PR a bit too quickly. I mean yes this is a bug and the PR does fix it... though the intended behavior appears to also not work.
Putting this into the settings.json file:

  "Lua.runtime.plugin": "foo.lua",
  "Lua.runtime.pluginArgs": {
    "foo": ["bar", "baz"],
    "unrelated": ["hello", "world"],
  },

The foo.lua plugin ends up getting {"foo", "unrelated"} as args. (expected: {"bar", "baz"})

The template

['Lua.runtime.pluginArgs'] = Type.Or(Type.Array(Type.String), Type.Hash(Type.String, Type.String)),

is also suspicious since I'd expect it to be Type.Or(Type.Array(Type.String), Type.Hash(Type.String, Type.Array(Type.String))) from looking at the plugin.lua file where the config is used.

Ultimately it seems like putting a hash table as the value for Lua.runtime.pluginArgs makes it parse it as an array containing just the keys. I've not looked into how these templates are used but I currently suspect that some generic code is responsible for that which makes it harder for me to just quickly look at.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants