iljapostnovs / VSCodeUI5Plugin

Visual Studio Code Extension for UI5 Development
Apache License 2.0
61 stars 6 forks source link

XML Linter does not recognize library in workplace in sap.ui.define #282

Closed professionally closed 1 year ago

professionally commented 1 year ago

Describe the bug I have a custom library in my workspace with a base controller. Unfortunately, when I import the BaseController of my library in "sap.ui.define", the class could not be recognized.

Other projects are determined correctly, so I could import a base controller of another project in my workspace, but it seems that it cannot find the "library"-structure.

It works and will be correctly loaded, as I referenced it in my ui5.yaml, but the code completion does not work and all references on my Controller are marked as warning.

I already tried to name the library in "libsToLoad"-setting but it does not work either: image

To Reproduce Steps to reproduce the behavior:

  1. Create a SAPUI5 library in your workspace (so with a library.js)
  2. Import SAPUI5 library in your project (manifest.json)
  3. See error: Cannot import custom controls of my library in sap.ui.define

Expected behavior The controls should be recognized in sap.ui.define, so I can use the auto completion and do not get lots of warnings

Screenshots My project structure: All projects within "packages" will be recognized correctly and can be imported but not the library. image

Error, that occurs: image

Example, that all other projects are recognized correctly image

Desktop (please complete the following information):

iljapostnovs commented 1 year ago

Hi,

Please provide minimal project example in order to reproduce the issue. Library recognition is working by itself, meaning that most probably something is missing in your project.

iljapostnovs commented 1 year ago

And please remove custom library from libsToLoad, it's related only to standard library metadata preload.

professionally commented 1 year ago

Hi, I did found the solution. I had to include the library in my package.json of the application.

image

Now the linting issue is fixed and no warnings are being displayed.

iljapostnovs commented 1 year ago

Unclear to me how that helps, if I understood the logic, this should remove all recognition of custom classes at all in the custom app. But if you are sure that it helps, it's good.