codetools: identifier completion: some keywords for library, program

git-svn-id: trunk@36983 -
This commit is contained in:
mattias 2012-04-22 22:55:58 +00:00
parent e055f6003b
commit b381e2ecce

View File

@ -1522,10 +1522,10 @@ var
NodeBehind: TCodeTreeNode; NodeBehind: TCodeTreeNode;
begin begin
Node:=Context.Node; Node:=Context.Node;
//debugln(['TIdentCompletionTool.GatherContextKeywords ',Node.DescAsString]); debugln(['TIdentCompletionTool.GatherContextKeywords ',Node.DescAsString]);
ReadPriorAtomSafe(CleanPos); ReadPriorAtomSafe(CleanPos);
//debugln(['TIdentCompletionTool.GatherContextKeywords prioratom=',CleanPosToStr(CurPos.StartPos),'=',GetAtom(CurPos)]); debugln(['TIdentCompletionTool.GatherContextKeywords prioratom=',CleanPosToStr(CurPos.StartPos),'=',GetAtom(CurPos)]);
NodeInFront:=nil; NodeInFront:=nil;
if CurPos.StartPos>0 then if CurPos.StartPos>0 then
NodeInFront:=FindDeepestNodeAtPos(CurPos.StartPos,false); NodeInFront:=FindDeepestNodeAtPos(CurPos.StartPos,false);
@ -1533,11 +1533,11 @@ begin
NodeBehind:=nil; NodeBehind:=nil;
MoveCursorToCleanPos(CleanPos); MoveCursorToCleanPos(CleanPos);
ReadNextAtom; ReadNextAtom;
//debugln(['TIdentCompletionTool.GatherContextKeywords nextatom=',CleanPosToStr(CurPos.StartPos),'=',GetAtom(CurPos)]); debugln(['TIdentCompletionTool.GatherContextKeywords nextatom=',CleanPosToStr(CurPos.StartPos),'=',GetAtom(CurPos)]);
if CurPos.StartPos>CleanPos then if CurPos.StartPos>CleanPos then
NodeBehind:=FindDeepestNodeAtPos(CurPos.StartPos,false); NodeBehind:=FindDeepestNodeAtPos(CurPos.StartPos,false);
//debugln(['TIdentCompletionTool.GatherContextKeywords Node=',Node.DescAsString,' NodeInFront=',NodeInFront.DescAsString,' NodeBehind=',NodeBehind.DescAsString]); debugln(['TIdentCompletionTool.GatherContextKeywords Node=',Node.DescAsString,' NodeInFront=',NodeInFront.DescAsString,' NodeBehind=',NodeBehind.DescAsString]);
case Node.Desc of case Node.Desc of
ctnClass,ctnObject,ctnRecordType,ctnObjCCategory,ctnObjCClass, ctnClass,ctnObject,ctnRecordType,ctnObjCCategory,ctnObjCClass,
@ -1656,13 +1656,13 @@ begin
end; end;
end; end;
ctnTypeSection,ctnVarSection,ctnConstSection,ctnLabelSection,ctnResStrSection: ctnTypeSection,ctnVarSection,ctnConstSection,ctnLabelSection,ctnResStrSection,
if (Node.FirstChild<>nil) ctnLibrary,ctnProgram:
and (Node.FirstChild.StartPos<CleanPos) begin
then begin
Add('type'); Add('type');
Add('const'); Add('const');
Add('var'); Add('var');
Add('resourcestring');
Add('procedure'); Add('procedure');
Add('function'); Add('function');
Add('property'); Add('property');
@ -2201,7 +2201,8 @@ begin
CurrentIdentifierList.ContextFlags:= CurrentIdentifierList.ContextFlags:=
CurrentIdentifierList.ContextFlags+[ilcfNeedsEndComma]; CurrentIdentifierList.ContextFlags+[ilcfNeedsEndComma];
end; end;
end else if CursorNode.Desc in AllSourceTypes then begin end else if (CursorNode.Desc in AllSourceTypes)
and (PositionsInSameLine(Src,CursorNode.StartPos,IdentStartPos)) then begin
GatherSourceNames(GatherContext); GatherSourceNames(GatherContext);
end else begin end else begin
FindCollectionContext(Params,IdentStartPos,CursorNode, FindCollectionContext(Params,IdentStartPos,CursorNode,