mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-31 09:32:41 +02:00
codetools: FindDeclaration: jump by default to next declaration
git-svn-id: trunk@26961 -
This commit is contained in:
parent
fd5e2ac392
commit
d4b9573bfb
@ -393,7 +393,8 @@ type
|
||||
Identifier: PChar;
|
||||
out NewCode: TCodeBuffer;
|
||||
out NewX, NewY, NewTopLine: integer): boolean;
|
||||
function FindSmartHint(Code: TCodeBuffer; X,Y: integer): string;
|
||||
function FindSmartHint(Code: TCodeBuffer; X,Y: integer;
|
||||
Flags: TFindSmartFlags = DefaultFindSmartHintFlags): string;
|
||||
function FindDeclarationInInterface(Code: TCodeBuffer;
|
||||
const Identifier: string; out NewCode: TCodeBuffer;
|
||||
out NewX, NewY, NewTopLine: integer): boolean;
|
||||
@ -1857,8 +1858,8 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TCodeToolManager.FindSmartHint(Code: TCodeBuffer; X, Y: integer
|
||||
): string;
|
||||
function TCodeToolManager.FindSmartHint(Code: TCodeBuffer; X, Y: integer;
|
||||
Flags: TFindSmartFlags): string;
|
||||
var
|
||||
CursorPos: TCodeXYPosition;
|
||||
begin
|
||||
@ -1874,7 +1875,7 @@ begin
|
||||
DebugLn('TCodeToolManager.FindSmartHint B ',dbgs(FCurCodeTool.Scanner<>nil));
|
||||
{$ENDIF}
|
||||
try
|
||||
Result:=FCurCodeTool.FindSmartHint(CursorPos);
|
||||
Result:=FCurCodeTool.FindSmartHint(CursorPos,Flags);
|
||||
except
|
||||
on e: Exception do HandleException(e);
|
||||
end;
|
||||
|
@ -21,7 +21,16 @@
|
||||
Author: Mattias Gaertner
|
||||
|
||||
Abstract:
|
||||
TCTConfigScriptEngine implements an interpreter for simple parscal like
|
||||
programs.
|
||||
|
||||
Working:
|
||||
if, then, else, begin..end, ;, (), not, and, or, xor, =, <>, >, <, <=, >=,
|
||||
:=, defined(), variable,
|
||||
constants: decimal, hex, octal, binary, string, #decimal
|
||||
ToDo:
|
||||
+=, string(), integer(), int64(), shl, shr, div, mod, *, +, -
|
||||
+, - as unary operator
|
||||
}
|
||||
unit CodeToolsCfgScript;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="8"/>
|
||||
<Version Value="7"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasUsesSectionForAllUnits Value="False"/>
|
||||
@ -42,12 +42,7 @@
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="9"/>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<UseAnsiStrings Value="False"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<Version Value="8"/>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
|
@ -548,7 +548,8 @@ type
|
||||
);
|
||||
|
||||
const
|
||||
DefaultFindSmartFlags = [fsfIncludeDirective,fsfFindMainDeclaration];
|
||||
DefaultFindSmartFlags = [fsfIncludeDirective];
|
||||
DefaultFindSmartHintFlags = DefaultFindSmartFlags+[fsfFindMainDeclaration];
|
||||
|
||||
type
|
||||
//----------------------------------------------------------------------------
|
||||
@ -792,7 +793,8 @@ type
|
||||
function SearchUnitInUnitLinks(const TheUnitName: string): string;
|
||||
function SearchUnitInUnitSet(const TheUnitName: string): string;
|
||||
|
||||
function FindSmartHint(const CursorPos: TCodeXYPosition): string;
|
||||
function FindSmartHint(const CursorPos: TCodeXYPosition;
|
||||
Flags: TFindSmartFlags = DefaultFindSmartHintFlags): string;
|
||||
|
||||
function BaseTypeOfNodeHasSubIdents(ANode: TCodeTreeNode): boolean;
|
||||
function FindBaseTypeOfNode(Params: TFindDeclarationParams;
|
||||
@ -1454,9 +1456,9 @@ begin
|
||||
// raise exception
|
||||
CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true);
|
||||
end;
|
||||
{$IFDEF CTDEBUG}
|
||||
{ $IFDEF CTDEBUG}
|
||||
DebugLn('TFindDeclarationTool.FindDeclaration D CursorNode=',NodeDescriptionAsString(CursorNode.Desc),' HasChilds=',dbgs(CursorNode.FirstChild<>nil));
|
||||
{$ENDIF}
|
||||
{ $ENDIF}
|
||||
if (not IsDirtySrcValid)
|
||||
and (CursorNode.Desc in [ctnUsesSection,ctnUseUnit]) then begin
|
||||
// in uses section
|
||||
@ -2110,8 +2112,8 @@ begin
|
||||
Result:=DirectoryCache.FindUnitInUnitSet(TheUnitName);
|
||||
end;
|
||||
|
||||
function TFindDeclarationTool.FindSmartHint(const CursorPos: TCodeXYPosition
|
||||
): string;
|
||||
function TFindDeclarationTool.FindSmartHint(const CursorPos: TCodeXYPosition;
|
||||
Flags: TFindSmartFlags): string;
|
||||
var
|
||||
NewTool: TFindDeclarationTool;
|
||||
NewNode, IdentNode, TypeNode, ANode: TCodeTreeNode;
|
||||
@ -2124,10 +2126,9 @@ var
|
||||
NodeStr: String;
|
||||
begin
|
||||
Result:='';
|
||||
if not FindDeclaration(CursorPos,DefaultFindSmartFlags,
|
||||
NewTool,NewNode,NewPos,NewTopLine) then
|
||||
if not FindDeclaration(CursorPos,Flags,NewTool,NewNode,NewPos,NewTopLine) then
|
||||
begin
|
||||
// identifier not found or already at declaration
|
||||
// identifier not found
|
||||
exit;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user