Open Danieleeee opened 7 years ago
Hi, I do it like this:
{
"version": "2.0.0",
"tasks": [
{
"label": "Wrap & Install",
"type": "shell",
"args": [
"\"${fileDirname}\"",
"${fileBasenameNoExtension}",
"${fileExtname}",
"user/pass@tnsname"
],
"command": "c:\\oracle\\wrapAndInstall.bat",
"problemMatcher": {
"owner": "plsql",
"fileLocation": [
"relative",
"${fileDirname}"
],
"pattern": [
{
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error|WARNING|ERROR):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
]
}
}
]
}
In file wrapAndInstall.bat I mainly wrap and remove last line before \ and I use UnxTools for that, but if you don't want to wrap Your code just use line with sqlplur.exe
@echo off
cls
set fileDirname=%1
set fileName=%2
set fileExtension=%3
set connectionString=%4
echo %fileDirname% %fileName% %fileExtension%
rm %fileDirname%\%fileName%.plb
rm %fileDirname%\%fileName%.wrap
wrap.exe iname=%fileDirname%\%fileName%%fileExtension% oname=%fileDirname%\%fileName%.plb edebug=wrap_new_sql
gawk.exe "/./" < %fileDirname%\%fileName%.plb > %fileDirname%\%fileName%.wrap
rm %fileDirname%\%fileName%.plb
echo FILE:%fileName%.sql:
sqlplus.exe %connectionString% @"c:\oracle\product\12.1.0\client_2\BIN\plsql_compile.sql" %fileDirname%\%fileName%.wrap %fileName% %fileExtension%
rm %fileDirname%\%fileName%.wrap
The plsql_compile.sql file installs package and write formatted errors into consol which is then parsed by problem matcher. This solution is not perfect but it works. A, one more thing. I use following naming which is then taken into consideration in below script:
set echo OFF
SET DEFINE ~
SET LINESIZE 1024
/
@"~1"
/
SET serveroutput ON
/
begin
for vr_error in (select REGEXP_REPLACE('~2','^(.*)_(p|b|P|B)$','\1') ||
CASE
WHEN UPPER(REGEXP_REPLACE('~2','^(.*)_(p|b|P|B)$','\2')) IN ('P','B')
THEN DECODE(TYPE,'PACKAGE','_p','PACKAGE BODY','_b','')
ELSE NULL
END || '~3' || ':'|| LINE|| ':' ||POSITION || ': '||ATTRIBUTE||': '|| replace(TEXT,CHR(10),' ') errormsg
from user_errors
where name = upper(CASE WHEN REGEXP_LIKE('~2', '^(.*)_(p|b|P|B)$')
THEN REGEXP_REPLACE('~2','^(.*)_(p|b|P|B)$','\1')
ELSE '~2'
END
)
order by SEQUENCE)
loop
DBMS_OUTPUT.Put_Line( vr_error.errormsg );
end loop;
end;
/
exit;
Hope this will help you configure your tasks with problem matcher.
Can you implement ProblemMatcher for this extension? vscode issues #28722
This is the result:
Exemple of task.json: