MG: fixed result of running external tools, fixed starting codetools in include files

git-svn-id: trunk@622 -
This commit is contained in:
lazarus 2002-01-24 16:23:27 +00:00
parent 096970d6f2
commit b660741d69
3 changed files with 16 additions and 4 deletions

View File

@ -453,6 +453,11 @@ begin
fErrorMsg:='TCodeToolManager.InitCurCodeTool MainCode=nil';
exit;
end;
if MainCode.Scanner=nil then begin
FErrorMsg:='No scanner found for "'+MainCode.Filename+'".'
+' If this is an include file, please open the main source first.';
exit;
end;
FCurCodeTool:=TCodeCompletionCodeTool(GetCodeToolForSource(MainCode,true));
FCurCodeTool.ErrorPosition.Code:=nil;
{$IFDEF CTDEBUG}
@ -1320,8 +1325,14 @@ begin
MainCode:=GetMainCode(Code); // create a scanner
if (MainCode<>Code) then begin
if ExceptionOnError then
raise Exception.Create('the source file "'+Code.Filename+'"'
+' is an include file of "'+Code.Filename+'"');
raise Exception.Create('the source "'+Code.Filename+'"'
+' is an include file of "'+MainCode.Filename+'"');
exit;
end;
if Code.Scanner=nil then begin
if ExceptionOnError then
raise Exception.Create('No scanner found for "'+Code.Filename+'".'
+' If this is an include file, please open the main source first.');
exit;
end;
Result:=TCodeCompletionCodeTool.Create;

View File

@ -63,7 +63,7 @@ interface
{$I codetools.inc}
{ $DEFINE CTDEBUG}
{$DEFINE CTDEBUG}
{ $DEFINE ShowTriedFiles}
{ $DEFINE ShowTriedContexts}

View File

@ -301,6 +301,7 @@ writeln('[TExternalToolList.Run] ',CmdLine);
TheProcess.WaitOnExit;
TheProcess.Free;
end;
Result:=mrOk;
except
on e: EOutputFilterError do begin
ErrorOccurred:=true;
@ -312,6 +313,7 @@ writeln('[TExternalToolList.Run] ',CmdLine);
end;
end else begin
AddRunningTool(TheProcess,true);
Result:=mrOk;
end;
except
on e: Exception do
@ -319,7 +321,6 @@ writeln('[TExternalToolList.Run] ',CmdLine);
'Unable to run the tool "'+Title+'":'#13+e.Message,mtError,[mbOk],0);
end;
end;
Result:=mrOk;
end;
function TExternalToolList.Save(XMLConfig: TXMLConfig;