mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-10-31 12:01:27 +01:00 
			
		
		
		
	IDE: word completion: don't add words in place of a sub-identifier (myObject.|)
git-svn-id: trunk@58158 -
This commit is contained in:
		
							parent
							
								
									47490073fe
								
							
						
					
					
						commit
						55dd4fef2b
					
				| @ -125,6 +125,7 @@ type | ||||
|     FOnGatherExternalChanges: TOnGatherExternalChanges; | ||||
|     FOnFindDefinePropertyForContext: TOnFindDefinePropertyForContext; | ||||
|     FOnFindDefineProperty: TOnFindDefineProperty; | ||||
|     FOnGatherUserIdentifiers: TOnGatherUserIdentifiers; | ||||
|     FOnGetIndenterExamples: TOnGetFABExamples; | ||||
|     FOnGetMethodName: TOnGetMethodname; | ||||
|     FOnRescanFPCDirectoryCache: TNotifyEvent; | ||||
| @ -144,6 +145,8 @@ type | ||||
|     FWriteLockStep: integer; // current write lock ID | ||||
|     FHandlers: array[TCodeToolManagerHandler] of TMethodList; | ||||
|     FErrorDbgMsg: string; | ||||
|     procedure DoOnGatherUserIdentifiers(Sender: TIdentCompletionTool; | ||||
|       const ContextFlags: TIdentifierListContextFlags); | ||||
|     procedure DoOnRescanFPCDirectoryCache(Sender: TObject); | ||||
|     function GetBeautifier: TBeautifyCodeOptions; inline; | ||||
|     function DoOnScannerGetInitValues(Scanner: TLinkScanner; Code: Pointer; | ||||
| @ -379,6 +382,8 @@ type | ||||
|                                                write FOnGetMethodName; | ||||
|     property OnGetIndenterExamples: TOnGetFABExamples | ||||
|                        read FOnGetIndenterExamples write FOnGetIndenterExamples; | ||||
|     property OnGatherUserIdentifiers: TOnGatherUserIdentifiers | ||||
|       read FOnGatherUserIdentifiers write FOnGatherUserIdentifiers; | ||||
| 
 | ||||
|     // data function | ||||
|     procedure FreeListOfPCodeXYPosition(var List: TFPList); | ||||
| @ -5811,6 +5816,14 @@ begin | ||||
|     Result:=nil; | ||||
| end; | ||||
| 
 | ||||
| procedure TCodeToolManager.DoOnGatherUserIdentifiers( | ||||
|   Sender: TIdentCompletionTool; const ContextFlags: TIdentifierListContextFlags | ||||
|   ); | ||||
| begin | ||||
|   if Assigned(FOnGatherUserIdentifiers) then | ||||
|     FOnGatherUserIdentifiers(Sender, ContextFlags); | ||||
| end; | ||||
| 
 | ||||
| function TCodeToolManager.DoOnGetSrcPathForCompiledUnit(Sender: TObject; | ||||
|   const AFilename: string): string; | ||||
| begin | ||||
| @ -6122,6 +6135,7 @@ begin | ||||
|     TCodeTool(Result).OnGetSrcPathForCompiledUnit:=@DoOnGetSrcPathForCompiledUnit; | ||||
|     TCodeTool(Result).OnGetMethodName:=@DoOnInternalGetMethodName; | ||||
|     TCodeTool(Result).OnRescanFPCDirectoryCache:=@DoOnRescanFPCDirectoryCache; | ||||
|     TCodeTool(Result).OnGatherUserIdentifiers:=@DoOnGatherUserIdentifiers; | ||||
|     TCodeTool(Result).DirectoryCache:= | ||||
|       DirectoryCachePool.GetCache(ExtractFilePath(Code.Filename), | ||||
|                                   true,true); | ||||
|  | ||||
| @ -375,6 +375,9 @@ type | ||||
|   //---------------------------------------------------------------------------- | ||||
|   // TIdentCompletionTool | ||||
| 
 | ||||
|   TOnGatherUserIdentifiers = procedure(Sender: TIdentCompletionTool; | ||||
|     const ContextFlags: TIdentifierListContextFlags) of object; | ||||
| 
 | ||||
|   TIdentCompletionTool = class(TFindDeclarationTool) | ||||
|   private | ||||
|     FBeautifier: TBeautifyCodeOptions; | ||||
| @ -388,6 +391,7 @@ type | ||||
|     FIDTTreeOfUnitFiles_NamespacePath: string; | ||||
|     FIDTTreeOfUnitFiles_CaseInsensitive: Boolean; | ||||
|     FIDTTreeOfNamespaces: TAVLTree;// tree of TNameSpaceInfo | ||||
|     FOnGatherUserIdentifiers: TOnGatherUserIdentifiers; | ||||
|     procedure AddToTreeOfUnitFileInfo(const AFilename: string); | ||||
|     procedure AddBaseConstant(const BaseName: PChar); | ||||
|     procedure AddBaseType(const BaseName: PChar); | ||||
| @ -408,6 +412,7 @@ type | ||||
|     procedure GatherSourceNames(const Context: TFindContext); | ||||
|     procedure GatherContextKeywords(const Context: TFindContext; | ||||
|       CleanPos: integer; BeautifyCodeOptions: TBeautifyCodeOptions); | ||||
|     procedure GatherUserIdentifiers(const ContextFlags: TIdentifierListContextFlags); | ||||
|     procedure InitCollectIdentifiers(const CursorPos: TCodeXYPosition; | ||||
|       var IdentifierList: TIdentifierList); | ||||
|     function ParseSourceTillCollectionStart(const CursorPos: TCodeXYPosition; | ||||
| @ -442,6 +447,8 @@ type | ||||
|     property Beautifier: TBeautifyCodeOptions read FBeautifier write FBeautifier; | ||||
| 
 | ||||
|     procedure CalcMemSize(Stats: TCTMemStats); override; | ||||
| 
 | ||||
|     property OnGatherUserIdentifiers: TOnGatherUserIdentifiers read FOnGatherUserIdentifiers write FOnGatherUserIdentifiers; | ||||
|   end; | ||||
| 
 | ||||
| function dbgs(Flag: TIdentifierListContextFlag): string; overload; | ||||
| @ -1590,6 +1597,13 @@ begin | ||||
|   end; | ||||
| end; | ||||
| 
 | ||||
| procedure TIdentCompletionTool.GatherUserIdentifiers( | ||||
|   const ContextFlags: TIdentifierListContextFlags); | ||||
| begin | ||||
|   if Assigned(FOnGatherUserIdentifiers) then | ||||
|     FOnGatherUserIdentifiers(Self, ContextFlags); | ||||
| end; | ||||
| 
 | ||||
| procedure TIdentCompletionTool.GatherUnitnames(const NameSpacePath: string); | ||||
| 
 | ||||
|   procedure GatherUnitsFromSet; | ||||
| @ -3057,6 +3071,7 @@ begin | ||||
|         DebugLn('TIdentCompletionTool.GatherIdentifiers G'); | ||||
|         {$ENDIF} | ||||
|         GatherUsefulIdentifiers(IdentStartPos,CursorContext,GatherContext); | ||||
|         GatherUserIdentifiers(CurrentIdentifierList.ContextFlags); | ||||
|       end; | ||||
| 
 | ||||
|       Result:=true; | ||||
|  | ||||
							
								
								
									
										12
									
								
								ide/main.pp
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								ide/main.pp
									
									
									
									
									
								
							| @ -617,6 +617,8 @@ type | ||||
|                 ); | ||||
|     procedure CodeToolBossFindFPCMangledSource(Sender: TObject; | ||||
|       SrcType: TCodeTreeNodeDesc; const SrcName: string; out SrcFilename: string); | ||||
|     procedure CodeToolBossGatherUserIdentifiers(Sender: TIdentCompletionTool; | ||||
|       const ContextFlags: TIdentifierListContextFlags); | ||||
| 
 | ||||
|     function CTMacroFunctionProject(Data: Pointer): boolean; | ||||
|     procedure CompilerParseStampIncHandler; | ||||
| @ -2026,6 +2028,14 @@ begin | ||||
|   SrcFilename:=''; | ||||
| end; | ||||
| 
 | ||||
| procedure TMainIDE.CodeToolBossGatherUserIdentifiers( | ||||
|   Sender: TIdentCompletionTool; const ContextFlags: TIdentifierListContextFlags | ||||
|   ); | ||||
| begin | ||||
|   if not (ilcfStartIsSubIdent in ContextFlags) then | ||||
|     DoAddWordsToIdentCompletion; | ||||
| end; | ||||
| 
 | ||||
| {------------------------------------------------------------------------------} | ||||
| procedure TMainIDE.MainIDEFormClose(Sender: TObject; | ||||
|   var CloseAction: TCloseAction); | ||||
| @ -9314,6 +9324,7 @@ begin | ||||
|     OnGetIndenterExamples:=@CodeToolBossGetIndenterExamples; | ||||
|     OnScannerInit:=@CodeToolBossScannerInit; | ||||
|     OnFindFPCMangledSource:=@CodeToolBossFindFPCMangledSource; | ||||
|     OnGatherUserIdentifiers:=@CodeToolBossGatherUserIdentifiers; | ||||
|   end; | ||||
| 
 | ||||
|   CodeToolsOpts.AssignGlobalDefineTemplatesToTree(CodeToolBoss.DefineTree); | ||||
| @ -10192,7 +10203,6 @@ begin | ||||
|   LogCaretXY:=ActiveSrcEdit.EditorComponent.LogicalCaretXY; | ||||
|   Result:=CodeToolBoss.GatherIdentifiers(ActiveUnitInfo.Source, | ||||
|                                          LogCaretXY.X,LogCaretXY.Y); | ||||
|   DoAddWordsToIdentCompletion; | ||||
| 
 | ||||
|   if not Result then begin | ||||
|     if JumpToError then | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 ondrej
						ondrej