-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Updated TypeProvider to support different method/function parameters #67
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.
welcome to the club. ;)
a test would be nice. also you broken some function type tests
|
||
PsiElement parameter = parameters[0]; | ||
HashMap<Integer, String> parameterSignatures = new HashMap<>(); |
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.
switch HashMap
to Map
for variable declaration
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.
Done.
.map(entry -> entry.getKey() + entry.getValue()) | ||
.collect(Collectors.joining(String.valueOf(trimKey))); | ||
|
||
return refSignature + trimKey + trimKey + parametersSignature; |
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 are you using a double trimKey?
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.
So it can be split on in getBySignature
. I know this is weird. I'm joining multiple parameter pairs with the trim key as well, so I couldn't split on that one character alone.
This doThing('Foo', 'Bar')
looks like this {refSignature} ƕƕ 0Foo ƕ 1Bar
(added spaces for clarity).
As I said in the PR description, I'm happy to do it another way. I'm just not sure which characters would be allowed that wouldn't mess up other things.
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.
whats about this solution?
{refSignature}ƕ0#Fooƕ1#Bar
Find first special char and then split it. in additional we support +9 parameter also, as you extracting just the first char for parameter index
I'm struggling to get the tests running locally.
I've add |
@@ -16,46 +17,66 @@ | |||
|
|||
@Nullable | |||
public static String getReferenceSignature(FunctionReference methodReference, char trimKey) { | |||
return getReferenceSignature(methodReference, trimKey, 1); | |||
return getReferenceSignature(methodReference, trimKey, 0); |
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 current tests failing because of this change. as index starts by 0
Ah ok so adding those to the SDK fixed it...but I'm not sure that's correct. The SDK makes them like global dependencies, right? This leaves me wondering what the java-i18n, properties, junit, css, php dependencies are for if they are specified in the SDK. Anyways I can work on the tests now, and I'll keep playing with the dependencies. Glad I don't have to be the one to make sure the compilation is correct ;) |
4d50be6
to
24d22cb
Compare
Ok tests caught a bug I had, fixed that and added tests for new functionality. Tests pass locally, Travis is just being derpy. |
@CarsonF travis build environment fixed in master please rebase. in additional a simple example with the new |
i also dont know why dependencies must declared in this way. but its working ;) |
24d22cb
to
dc76fe1
Compare
…besides the first with "index" parameter.
dc76fe1
to
68c468f
Compare
Done! 😄 |
thx! will build new release soon |
Nice to see new contributor |
@Haehnchen thanks for 2faefdb. I thought |
problem was: part -> Integer.parseInt(part.substring(0, 1)),
part -> PhpTypeProviderUtil.getResolvedParameter(phpIndex, part.substring(1)) empty string provided, had no idea why, but lesson learned in all plugins: try to validate everything ;) |
Updated TypeProvider to support different method/function parameters besides the first with "index" parameter.
Fixes #20
This is my first PR for an idea plugin, so advice is very much appreciated.
It seems like when creating the signature, we don't know the class name. So we need to add the types of all indexes that could be needed and match it later in
getBySignature
. I did that by concatenating each index and its type and joining those with thetrimKey
and then joining that to therefSignature
with two of thetrimKey
chars. This breaks if the index wanted is greater than 9 but I figured that was an ok risk. I'm happy to change it to another kind of pattern, I'm just not sure what I can use to delineate on here.I don't know what kind of BC we are trying to provide here. This does break BC for
PhpTypeProviderUtil
if it was called directly. Nothing has changed withPhpToolboxTypeProviderInterface
which I figure is the one everyone is using.