ui5-language-assistant icon indicating copy to clipboard operation
ui5-language-assistant copied to clipboard

Getting errors for duplicate IDs across different view files

Open patakihara opened this issue 1 year ago • 6 comments

I'm now getting a highlighted error when using the same IDs across different view files. For instance, in the file ShopItemListReport.view.xml:

Select a unique ID. The current "dynamicPageId" ID has already been used. UI5 Language Assistant
ShopPackageListReport.view.xml(13, 12): An identical ID is also used here.

I have some generic controller classes that I reuse across similar views, and they depend on those views having controls with particular IDs, so this would break many of my implementations. This "error" wasn't being highlighted before, and I'm not exactly sure what caused it to be highlighted. I first noticed when updating my project's dependencies, but checking out an earlier branch hasn't prevented it from showing up again.

Is there a way to disable this check?

Someone else has come up with this issue recently and reported it here: iljapostnovs/VSCodeUI5Plugin#422

This may also be related to #646

patakihara avatar Sep 07 '24 10:09 patakihara

Issue is gone after rolling back to version 4.0.66

patakihara avatar Sep 07 '24 10:09 patakihara

Yes we are getting the same error with the new update, rolling back to version 4.0.66 solved it, but I wonder what is the reasoning behind this addition.

RagabAhmed avatar Sep 08 '24 15:09 RagabAhmed

@patakihara Thanks for your feedback. This is a new feature added recently based on this enhancement request: https://github.com/SAP/ui5-language-assistant/issues/646 We can think if we would like to convert these error messages to warnings or handle them otherwise, but so far we consider that as a useful feature, as in many cases non-unique IDs in different files do brake the app in runtime

MN-public avatar Sep 09 '24 07:09 MN-public

@MN-public

In my project this won't brake the app in runtime, and I require having the same IDs in different views to avoid duplicate code in my controllers.

Would it be possible to add a setting to disable this check, or at least make it a warning? Thank you!

patakihara avatar Sep 09 '24 08:09 patakihara

@patakihara Thanks for explaining your use case. We will see what we can do.

MN-public avatar Sep 09 '24 08:09 MN-public

I would also vote for the possibility to disabling this message. Also I see no use to make the control ids view dependent and producing an error when using this id in different views.

s-v-o avatar Sep 16 '24 16:09 s-v-o

@patakihara we have provided user settings to limit diagnostic reporting on unique ids. You can download v4.0.75 and test it.Early feedback is highly appreciated. :) User setting by default is not set, you can set it to limit diagnostic reporting. The settings looks like: image

If this setting solves your issue, please close this issue. Thanks a lot.

marufrasully avatar Oct 16 '24 08:10 marufrasully

@marufrasully it's working as intended! Thank you so much 😄

Sorry for the delay in closing the issue!

patakihara avatar Nov 05 '24 09:11 patakihara