iljapostnovs / VSCodeUI5Plugin

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

ui5.plugin.excludeFolderPattern for project/custom reuse library #297

Closed zdlcloud closed 1 year ago

zdlcloud commented 1 year ago

Describe the bug I will get WrongFieldMethodLinter(UI5Plugin) warnning when call a method inhert from custom reuse library. How I config ui5.plugin.excludeFolderPattern?

Expected behavior

My settings:

"ui5.plugin.excludeFolderPattern": [
    "**/resources/**",
    "**/dist/**/**",
    "**/node_modules/(?!(com.abc.reuselib/).*/"
  ]

But it still not works.

iljapostnovs commented 1 year ago

Hi. Please give me more details about the issue. First of all, my first suggestion would be to fix linting errors :) If you don't want to do it, then please explain to me what exactly you want to achieve? If you want to exclude the library as a whole, I do not recommend it, but if you wish you can do it by excluding, yes. excludeFolderPattern uses glob pattern, you might google it. (e.g. A Beginner's Guide: Glob Patterns)

iljapostnovs commented 1 year ago

And please spend some time reading linter documentation. There are configuration examples with comments.

zdlcloud commented 1 year ago

Sorry for causing this lost and Thanks a lot for response. Let me use below common case for example.

my.app/
    \_ node_modules/
    \_ webapp/
    \_ ui5.yaml
    \_ package.json
my.reuse.library/
    \_ node_modules/
    \_ src/
    \_ test/
    \_ ui5.yaml
    \_ package.json

image

As mentioned in UI5 CLI document, I use npm link my.reuse.library in my.app. What I want to see when I cmd+click the method I can navigate to where it is definded in the reuse lib. but currently it shows WrongFieldMethodLinter(UI5Plugin) linter issue. Then I notice this settings for ui5.plugin.excludeFolderPattern, it exclude all node_modules folder. So I am trying to change it to ignore all node_modules except my.reuse.library like previous info. I think I already use correct glob pattern. but it still not work. Cloud you please correct me where is the problem? How can I let my.app know the methods inherit from super class in my.resuse.library? Many thanks.

iljapostnovs commented 1 year ago

According to your description, your folder structure looks like this:

├── my.app
│   ├── node_modules
│   │   ├── my.reuse.library
│   │   │   ├── node_modules
│   │   │   ├── src
│   │   │   ├── test
│   │   │   ├── ui5.yaml
│   │   │   ├── package.json
│   ├── webapp
│   ├── ui5.yaml
│   ├── package.json

but you provided this:

my.app/
    \_ node_modules/
    \_ webapp/
    \_ ui5.yaml
    \_ package.json
my.reuse.library/
    \_ node_modules/
    \_ src/
    \_ test/
    \_ ui5.yaml
    \_ package.json

So which one is it? In any case, I would recommend using Multi-root workspace with my.app and my.reuse.library as two separate projects in one workspace. Example: image

This should work as expected without changing excludeFolderPattern

zdlcloud commented 1 year ago

after run npm link my.reuse.library in my.app, it will be like the first one you mentioned.

├── my.app
│   ├── node_modules
│   │   ├── my.reuse.library
│   │   │   ├── node_modules
│   │   │   ├── src
│   │   │   ├── test
│   │   │   ├── ui5.yaml
│   │   │   ├── package.json
│   ├── webapp
│   ├── ui5.yaml
│   ├── package.json

I think to use excludeFolderPattern can support above structure. Right? But it seems not work, this is my question. I know multi-root workspace, from my experience, it is better just run npm link my.reuse.library after clone a app than create a workspace if you have many app repos.

iljapostnovs commented 1 year ago

after run npm link my.reuse.library in my.app, it will be like the first one you mentioned.

├── my.app
│   ├── node_modules
│   │   ├── my.reuse.library
│   │   │   ├── node_modules
│   │   │   ├── src
│   │   │   ├── test
│   │   │   ├── ui5.yaml
│   │   │   ├── package.json
│   ├── webapp
│   ├── ui5.yaml
│   ├── package.json

I think to use excludeFolderPattern can support above structure. Right? But it seems not work, this is my question. I know multi-root workspace, from my experience, it is better just run npm link my.reuse.library after clone a app than create a workspace if you have many app repos.

I don't know if excludeFolderPattern would work with it, but theoretically it could. I've provided the guide to glob patterns previously, you might check it. Just remember that RegExp and glob are not the same thing. According to glob documentation maybe something like **/node_modules/(!(com.abc.reuselib/))** would work, but not sure about that.

I do recommend using multi-root workspace instead of fighting with glob patterns.

zdlcloud commented 1 year ago

Thanks a lot for your response and your patience. 💯