dcd, perfs, declare imports in group

This commit is contained in:
Basile Burg 2016-02-05 09:59:15 +01:00
parent 154025b143
commit 5f8cb1a679
3 changed files with 38 additions and 8 deletions

View File

@ -52,6 +52,7 @@ type
constructor create(aOwner: TComponent); override;
destructor destroy; override;
//
procedure addImportFolders(const folders: TStrings);
procedure addImportFolder(const aFolder: string);
procedure getComplAtCursor(aList: TStrings);
procedure getCallTip(out tips: string);
@ -155,7 +156,7 @@ begin
if fold.dirExists and (folds.IndexOf(fold) = -1) then
folds.Add(fold);
end;
for fold in folds do addImportFolder(fold);
addImportFolders(folds);
finally
folds.Free;
end;
@ -255,6 +256,28 @@ begin
waitClient;
end;
procedure TCEDcdWrapper.addImportFolders(const folders: TStrings);
var
imp: string;
begin
if not fAvailable then exit;
if not fServerListening then exit;
//
fClient.Parameters.Clear;
for imp in folders do
begin
if fImportCache.IndexOf(imp) <> -1 then
continue;
fImportCache.Add(imp);
fClient.Parameters.Add('-I' + imp);
end;
if fClient.Parameters.Count <> 0 then
begin
fClient.Execute;
waitClient;
end;
end;
procedure TCEDcdWrapper.getCallTip(out tips: string);
begin
if not fAvailable then exit;

View File

@ -140,14 +140,21 @@ end;
procedure TLibraryManager.updateDCD;
var
itm: TLibraryItem;
str: TStringList;
i: Integer;
begin
if not DcdWrapper.available then exit;
// note: new items are directly handled but removed ones still in cache until server restarts.
for i := 0 to fCol.Count-1 do
begin
itm := TLibraryItem(fCol.Items[i]);
DcdWrapper.addImportFolder(itm.libSourcePath);
str := TStringList.Create;
try
for i := 0 to fCol.Count-1 do
begin
itm := TLibraryItem(fCol.Items[i]);
str.Add(itm.libSourcePath);
end;
DcdWrapper.addImportFolders(str);
finally
str.Free;
end;
end;

View File

@ -315,9 +315,9 @@ _DCD_ also has a native configuration system. Refer to the official [_Readme_](h
- <kbd>.</kbd> invokes the completion if the editor option _autoDotDelay_ is greater than 0.
- <kbd>CTRL</kbd> + <kbd>SHIFT</kbd> + <kbd>UP</kbd>: Jumps to the declaration of the symbol located at the cursor. The default shortcut can be modified.
- <kbd>CTRL</kbd> + <kbd>LEFT MOUSE BUTTON</kbd>: ditto.
- <kbd>(</kbd>: Gets the function call tips.
- <kbd>)</kbd>: Closes the call tips window.
- <kbd>ESC</kbd>: ditto.
- <kbd>(</kbd>: Gets the function call tips. When functions calls are nested, call tips are stacked and separated by a group of hyphen.
- <kbd>)</kbd>: If the call tips are displayed then decreases by one the stack of call tips.
- <kbd>ESC</kbd>: Closes the call tips window, whatever is the level of the stack.
Documentation comments associated to a symbol are displayed when hovering the symbol with the mouse.