iljapostnovs / VSCodeUI5Plugin

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

Bug: How to import a library #394

Closed daveloop closed 7 months ago

daveloop commented 8 months ago

Describe the bug I cannot figure out how to configure the ui5parser so that my ui5 project can see my ui5 library.

To Reproduce As a test in a /temp directory I have generated two default projects using the generator yo easy-ui5 [project|library]

The sample library gives you a component called Example. In the myui5app I try to use Example. In the /temp/com.myorg.myui5app/project.json I added:

  "ui5": {
    "ui5parser": {
       "additionalWorkspaces" : ["../com.myorg.mylib"]
    }
 }

Then I use vscode to load the folder /temp/com.myorg.myui5app

Expected behavior If I understand the terminology correctly: CWD = /temp/com.myorg.myui5app Workspace = /temp/com.myorg.myui5app/uimodule/webapp (where the manifest.json is)

But in the editor for BaseController.js I get an error when trying to import the Example

image

Desktop (please complete the following information):

iljapostnovs commented 8 months ago

Please provide minimal project example in order to reproduce the issue

daveloop commented 8 months ago

temp.zip

  1. npm install on both directories
  2. open the folder /temp/com.myorg.myui5app with vscode
  3. navigate to uimodule/webapp/controller/MainView.controller.js

You will see that it cannot resolve the Example import

This is similar to my own real life project. Note that the library doesn't have a manifest.json but it does have a library.js, also just like my real life project. I'm not allowed to create a manifest.json since I don't own the library.

the /temp/com.myorg.myui5app/package.json is where I tried to configure the parser.

iljapostnovs commented 8 months ago

Thanks for the example. The issue is that you don't have manifest.json in your library. Please add manifest and everything will be working as expected.