codetools: identifier completion: list pas2js default units

git-svn-id: trunk@57952 -
This commit is contained in:
mattias 2018-05-18 07:31:39 +00:00
parent 738fe94d96
commit e1dcfde200
4 changed files with 103 additions and 75 deletions

View File

@ -5873,11 +5873,9 @@ begin
if not IsDottedIdentifier(UnitName) then exit;
FileAndNameSpaceFits(UnitName, FileNameFits, NameSpaceFits);
if FileNameFits then
AddToTreeOfUnitFiles(TreeOfUnitFiles,FileName,UnitName,
KeepDoubles);
AddToTreeOfUnitFiles(TreeOfUnitFiles,FileName,UnitName,KeepDoubles);
if NameSpaceFits then
AddToTreeOfNamespaces(TreeOfNamespaces,UnitName,NameSpacePath,
KeepDoubles)
AddToTreeOfNamespaces(TreeOfNamespaces,UnitName,NameSpacePath,KeepDoubles)
end;
function GatherUnitFiles(const BaseDir, SearchPath, Extensions,

View File

@ -9037,6 +9037,7 @@ var
InfoTypes: TFPCInfoTypes;
BaseDir: String;
FullFilename: String;
e: PStringToStringItem;
begin
OldOptions:=TPCTargetConfigCache.Create(nil);
CfgFiles:=nil;
@ -9114,6 +9115,11 @@ begin
end;
// gather all units and include files in search paths
GatherUnitsInSearchPaths(UnitPaths,IncludePaths,OnProgress,Units,Includes,true);
//if Kind=pcPas2js then begin
// debugln(['TPCTargetConfigCache.Update Units:']);
// for e in Units do
// debugln([' ',E^.Name,' ',E^.Value]);
//end;
if (UnitPaths.Count=0) then begin
if CTConsoleVerbosity>=-1 then
debugln(['Warning: [TPCTargetConfigCache.Update] no unit paths: ',Compiler,' ',ExtraOptions]);

View File

@ -43,6 +43,7 @@ interface
{ $DEFINE ShowFilteredIdents}
{ $DEFINE ShowHistory}
{ $DEFINE VerboseCodeContext}
{ $DEFINE VerboseICGatherUnitNames}
uses
{$IFDEF MEM_CHECK}
@ -1620,21 +1621,30 @@ begin
// search in unitpath
FIDTTreeOfUnitFiles_CaseInsensitive := true;
FIDTTreeOfUnitFiles_NamespacePath := NameSpacePath;
UnitExt:='pp;pas;ppu';
{$IFDEF VerboseICGatherUnitNames}
FIDTTreeOfUnitFiles:=TAVLTree.Create(@CompareUnitFileInfos);
{$ENDIF}
UnitExt:=PascalCompilerUnitExt[Scanner.PascalCompiler];
if Scanner.CompilerMode=cmMacPas then
UnitExt:=UnitExt+';p';
GatherUnitFiles(BaseDir,UnitPath,UnitExt,NameSpacePath,false,true,FIDTTreeOfUnitFiles, FIDTTreeOfNamespaces);
//debugln(['TIdentCompletionTool.GatherUnitnames UnitPath ',FIDTTreeOfUnitFiles.Count]);
{$IFDEF VerboseICGatherUnitNames}
debugln(['TIdentCompletionTool.GatherUnitnames UnitPath ',FIDTTreeOfUnitFiles.Count]);
{$ENDIF}
// search in srcpath
SrcExt:='pp;pas';
SrcExt:=PascalCompilerSrcExt[Scanner.PascalCompiler];
if Scanner.CompilerMode=cmMacPas then
SrcExt:=SrcExt+';p';
GatherUnitFiles(BaseDir,SrcPath,SrcExt,NameSpacePath,false,true,FIDTTreeOfUnitFiles, FIDTTreeOfNamespaces);
//debugln(['TIdentCompletionTool.GatherUnitnames Plus SrcPath ',FIDTTreeOfUnitFiles.Count]);
// add unitlinks
if Scanner.PascalCompiler=pcFPC then
GatherUnitsFromSet;
//debugln(['TIdentCompletionTool.GatherUnitnames Plus FPC units ',FIDTTreeOfUnitFiles.Count]);
{$IFDEF VerboseICGatherUnitNames}
debugln(['TIdentCompletionTool.GatherUnitnames Plus SrcPath ',FIDTTreeOfUnitFiles.Count]);
{$ENDIF}
// add default units
GatherUnitsFromSet;
{$IFDEF VerboseICGatherUnitNames}
debugln(['TIdentCompletionTool.GatherUnitnames Plus FPC units ',FIDTTreeOfUnitFiles.Count]);
{$ENDIF}
// create list
if FIDTTreeOfUnitFiles<>nil then
begin
@ -1652,8 +1662,10 @@ begin
0,nil,nil,ctnUnit, PChar(UnitFileInfo.FileUnitName), UnitFileInfo.IdentifierStartInUnitName);
if NewItem.IdentifierStartInUnitName < 1 then
NewItem.IdentifierStartInUnitName := 1;
{$IFDEF VerboseICGatherUnitNames}
//debugln(['TIdentCompletionTool.GatherUnitnames Add ',UnitFileInfo.FileUnitName,' NewCount=',CurrentIdentifierList]);
CurrentIdentifierList.Add(NewItem);
{$ENDIF}
end;
end;
if FIDTTreeOfNamespaces<>nil then

View File

@ -160,6 +160,21 @@ type
cmISO,
cmExtPas
);
const
// upper case
CompilerModeNames: array[TCompilerMode] of string=(
'FPC',
'DELPHI',
'DELPHIUNICODE',
'GPC',
'TP',
'OBJFPC',
'MACPAS',
'ISO',
'EXTPAS'
);
type
{ TCompilerModeSwitch - see fpc/compiler/globtype.pas tmodeswitch }
TCompilerModeSwitch = (
//cms_FPC,cms_ObjFPC,cms_Delphi,cms_TP7,cms_Mac,cms_ISO,cms_ExtPas,
@ -250,6 +265,50 @@ const
);
cmAllModesWithGeneric = [cmDELPHI,cmDELPHIUNICODE,cmOBJFPC];
// upper case (see fpc/compiler/globtype.pas modeswitchstr )
CompilerModeSwitchNames: array[TCompilerModeSwitch] of string=(
'POINTERARITHMETICS',
'CLASS',
'OBJPAS',
'RESULT',
'PCHARTOSTRING',
'CVAR',
'NESTEDCOMMENTS',
'CLASSICPROCVARS',
'MACPROCVARS',
'REPEATFORWARD',
'POINTERTOPROCVAR',
'AUTODEREF',
'INITFINAL',
'ANSISTRINGS',
'OUT',
'DEFAULTPARAMETERS',
'HINTDIRECTIVE',
'DUPLICATELOCALS',
'PROPERTIES',
'ALLOWINLINE',
'EXCEPTIONS',
'OBJECTIVEC1',
'OBJECTIVEC2',
'NESTEDPROCVARS',
'NONLOCALGOTO',
'ADVANCEDRECORDS',
'ISOUNARYMINUS',
'SYSTEMCODEPAGE',
'FINALFIELDS',
'UNICODESTRINGS',
'TYPEHELPERS',
'CBLOCKS',
'ISOIO',
'ISOPROGRAMPARAS',
'ISOMOD',
'PREFIXEDATTRIBUTES',
'EXTERNALCLASS',
'IGNOREATTRIBUTES',
'IGNOREINTERFACES'
);
type
// see fpcsrc/compiler/globtype.pas toptimizerswitch
TOptimizerSwitch = (
@ -282,7 +341,22 @@ type
pcFPC,
pcDelphi,
pcPas2js);
const
// upper case
PascalCompilerNames: array[TPascalCompiler] of string=(
'FPC', 'DELPHI', 'PAS2JS'
);
PascalCompilerUnitExt: array[TPascalCompiler] of string = (
'pp;pas;ppu', // + p if TCompilerMode=cmMacPas
'pas;dcu',
'pas;pp;pcu;pju'
);
PascalCompilerSrcExt: array[TPascalCompiler] of string = (
'pp;pas', // + p if TCompilerMode=cmMacPas
'pas',
'pas;pp'
);
type
TLSSkippingDirective = (
lssdNone,
@ -780,68 +854,6 @@ type
function NewPSourceChangeStep: PSourceChangeStep;
end;
const
// upper case
CompilerModeNames: array[TCompilerMode] of string=(
'FPC',
'DELPHI',
'DELPHIUNICODE',
'GPC',
'TP',
'OBJFPC',
'MACPAS',
'ISO',
'EXTPAS'
);
// upper case (see fpc/compiler/globtype.pas modeswitchstr )
CompilerModeSwitchNames: array[TCompilerModeSwitch] of string=(
'POINTERARITHMETICS',
'CLASS',
'OBJPAS',
'RESULT',
'PCHARTOSTRING',
'CVAR',
'NESTEDCOMMENTS',
'CLASSICPROCVARS',
'MACPROCVARS',
'REPEATFORWARD',
'POINTERTOPROCVAR',
'AUTODEREF',
'INITFINAL',
'ANSISTRINGS',
'OUT',
'DEFAULTPARAMETERS',
'HINTDIRECTIVE',
'DUPLICATELOCALS',
'PROPERTIES',
'ALLOWINLINE',
'EXCEPTIONS',
'OBJECTIVEC1',
'OBJECTIVEC2',
'NESTEDPROCVARS',
'NONLOCALGOTO',
'ADVANCEDRECORDS',
'ISOUNARYMINUS',
'SYSTEMCODEPAGE',
'FINALFIELDS',
'UNICODESTRINGS',
'TYPEHELPERS',
'CBLOCKS',
'ISOIO',
'ISOPROGRAMPARAS',
'ISOMOD',
'PREFIXEDATTRIBUTES',
'EXTERNALCLASS',
'IGNOREATTRIBUTES',
'IGNOREINTERFACES'
);
// upper case
PascalCompilerNames: array[TPascalCompiler] of string=(
'FPC', 'DELPHI', 'PAS2JS'
);
const
DirectiveSequenceName: array [TSequenceDirective] of string =
('SCOPEDENUMS');