tomi / vscode-rf-language-server

VSCode extension to support Robot Framework development
MIT License
53 stars 35 forks source link

Include pattern matching doesn't work on Windows #20

Open DanielPBak opened 6 years ago

DanielPBak commented 6 years ago

With

"rfLanguageServer.includePaths": [
        "test\\robotframework\\*.robot"
    ],

(or with "test/robotframework/*.robot")

I get the following debug information:

[Trace - 1:28:56 PM] Sending request 'buildFromFiles - (1)'.
Params: {
    "files": [
        "c:\\Users\\danie01\\fox\\test\\robotframework\\App.robot",
        "c:\\Users\\danie01\\fox\\test\\robotframework\\Automation.robot",
        "c:\\Users\\danie01\\fox\\test\\robotframework\\Browsers.robot",
        "c:\\Users\\danie01\\fox\\test\\robotframework\\certApp.robot",
        "c:\\Users\\danie01\\fox\\test\\robotframework\\certCGI.robot",
        "c:\\Users\\danie01\\fox\\test\\robotframework\\CommonAdmin.robot",
        "c:\\Users\\danie01\\fox\\test\\robotframework\\Navigation.robot",
        "c:\\Users\\danie01\\fox\\test\\robotframework\\Notification.robot",
        "c:\\Users\\danie01\\fox\\test\\robotframework\\Requests.robot",
        "c:\\Users\\danie01\\fox\\test\\robotframework\\Search.robot",
        "c:\\Users\\danie01\\fox\\test\\robotframework\\Session.robot",
        "c:\\Users\\danie01\\fox\\test\\robotframework\\TrainingActions.robot",
        "c:\\Users\\danie01\\fox\\test\\robotframework\\UIHelpers.robot",
        "c:\\Users\\danie01\\fox\\test\\robotframework\\UserClass.robot",
        "c:\\Users\\danie01\\fox\\test\\robotframework\\Util.robot",
        "c:\\Users\\danie01\\fox\\test\\robotframework\\Wizard.robot"
    ]
}

buildFromFiles { files: 
   [ 'c:\\Users\\danie01\\fox\\test\\robotframework\\App.robot',
     'c:\\Users\\danie01\\fox\\test\\robotframework\\Automation.robot',
     'c:\\Users\\danie01\\fox\\test\\robotframework\\Browsers.robot',
     'c:\\Users\\danie01\\fox\\test\\robotframework\\certApp.robot',
     'c:\\Users\\danie01\\fox\\test\\robotframework\\certCGI.robot',
     'c:\\Users\\danie01\\fox\\test\\robotframework\\CommonAdmin.robot',
     'c:\\Users\\danie01\\fox\\test\\robotframework\\Navigation.robot',
     'c:\\Users\\danie01\\fox\\test\\robotframework\\Notification.robot',
     'c:\\Users\\danie01\\fox\\test\\robotframework\\Requests.robot',
     'c:\\Users\\danie01\\fox\\test\\robotframework\\Search.robot',
     'c:\\Users\\danie01\\fox\\test\\robotframework\\Session.robot',
     'c:\\Users\\danie01\\fox\\test\\robotframework\\TrainingActions.robot',
     'c:\\Users\\danie01\\fox\\test\\robotframework\\UIHelpers.robot',
     'c:\\Users\\danie01\\fox\\test\\robotframework\\UserClass.robot',
     'c:\\Users\\danie01\\fox\\test\\robotframework\\Util.robot',
     'c:\\Users\\danie01\\fox\\test\\robotframework\\Wizard.robot' ] }
Not accepting file c:\Users\danie01\fox\test\robotframework\App.robot. It doesn't match any include pattern.
Not accepting file c:\Users\danie01\fox\test\robotframework\Automation.robot. It doesn't match any include pattern.
Not accepting file c:\Users\danie01\fox\test\robotframework\Browsers.robot. It doesn't match any include pattern.
Not accepting file c:\Users\danie01\fox\test\robotframework\certApp.robot. It doesn't match any include pattern.
Not accepting file c:\Users\danie01\fox\test\robotframework\certCGI.robot. It doesn't match any include pattern.
Not accepting file c:\Users\danie01\fox\test\robotframework\CommonAdmin.robot. It doesn't match any include pattern.
Not accepting file c:\Users\danie01\fox\test\robotframework\Navigation.robot. It doesn't match any include pattern.
Not accepting file c:\Users\danie01\fox\test\robotframework\Notification.robot. It doesn't match any include pattern.
Not accepting file c:\Users\danie01\fox\test\robotframework\Requests.robot. It doesn't match any include pattern.
Not accepting file c:\Users\danie01\fox\test\robotframework\Search.robot. It doesn't match any include pattern.
Not accepting file c:\Users\danie01\fox\test\robotframework\Session.robot. It doesn't match any include pattern.
Not accepting file c:\Users\danie01\fox\test\robotframework\TrainingActions.robot. It doesn't match any include pattern.
Not accepting file c:\Users\danie01\fox\test\robotframework\UIHelpers.robot. It doesn't match any include pattern.
Not accepting file c:\Users\danie01\fox\test\robotframework\UserClass.robot. It doesn't match any include pattern.
Not accepting file c:\Users\danie01\fox\test\robotframework\Util.robot. It doesn't match any include pattern.
Not accepting file c:\Users\danie01\fox\test\robotframework\Wizard.robot. It doesn't match any include pattern.

So the pattern is picking up the files I desire (all the .robot files in \test\robotframework), but then excludes them because they don't match a pattern. Am I using this wrong?

**/*.robot and **/*.py work fine.

tomi commented 6 years ago

I think the correct pattern is **/test/robotframework/*.robot. That's because we use (perhaps incorrectly) the full path and not a relative path from the project root when matching against the include and exclude patterns.

DanielPBak commented 6 years ago

So:

**/fox/test/robotframework/*.robot doesn't work, but **/test/robotframework/*.robot does work (fox is the workspace root). What would be causing this?

The problem with **/test/robotframework/*.robot is that it searches my entire filesystem for /test/robotframework/*.robot, and I have a few directory structures like that that I would prefer not to be searching.

What's also interesting is that */.py searches my entire filesystem for .py files, and includes everything except c:\Users\danie01\.virtualenvs\robotframework-Ug8rGc7a\Lib\site-packages\robot\libraries\*.py files, which are included in the search but do not match the pattern.