3

I have a problem matcher defined like this:

"fileLocation": ["relative", "${workspaceFolder}"],

And I only know the name of the file and NOT the relative path from my compilation output. Than it only opens files when they are in the root of the workspace.

E.g. Problem matcher searches for: Package.sql But the file is under

  • root
    • Other Subfolders
    • PKGs
      • Package.sql

Is there a setting to let the problem matcher "find" that file, even if it's in a (unknown) subfolder? (Assumed all filenames are distinct)

S-Koell
  • 101
  • 8

2 Answers2

1

You can use "command" string for print file with relative or absolute path like this: echo FILEBEGIN${relativeFile}FILEEND or echo FILEBEGIN${file}FILEEND

And it will be easy to get file by regex.

If you are using oracle and powershell you can try my task:

{
   "label": "compile",
   "type": "shell",
   "command": "echo 'set define off' 'set serveroutput on' '@${file}' 'exit' | sqlplus ${config:plsql-language.connection.activeInfos} | Select-String -Pattern '(\\d+/\\d+.*|.*created.*)' | % {'${relativeFile}:' + $($_.matches.value)}",
   "group": {
      "kind": "build",
      "isDefault": true
   },
   "problemMatcher": {
      "owner": "PLSQL",
      "severity": "error",
      "fileLocation":  ["relative", "${workspaceFolder}"],
      "pattern":
         {
            "regexp": "^(.*):(\\d+)\\/(\\d+)\\s+((PLS|ORA)-\\d+):(.*)$",
            "file": 1,
            "line": 2,
            "column": 3,
            "code": 4,
            "message": 6
         }
   }
}
  • Thanks for that. But that task doesnt fully work for me. It compiles the file to the db but I dont get the errors back. It says in the terminal : abc.pkg :Warning: Package created with compilation errors. – S-Koell Mar 06 '20 at 08:13
  • I changed regexp a bit. And do you have "SHOW ERRORS" at the end of package file? Pls add it if not exist. – Ivan Dubashinskii Mar 07 '20 at 09:06
0

The problem matcher should return either absolute path, or path relative to a fixed folder inside the workspace. If you have a filename only, without absolute/relative path, in my understanding Code won't be able to locate the file as the name only is not enough information. There is also the autodetect option. You can try something like this: "fileLocation": ["autodetect", "${workspaceFolder}/subfolder1/subfolder2"]

vjalle
  • 549
  • 4
  • 13