mirror of https://gitlab.com/basile.b/dexed.git
fix #255 - Propose to open html doc even when "F1" help failed to locate the anchor
This commit is contained in:
parent
7fcd05ed30
commit
3a8248296a
|
@ -1688,13 +1688,10 @@ begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCESynMemo.ShowPhobosDoc;
|
procedure TCESynMemo.ShowPhobosDoc;
|
||||||
procedure errorMessage;
|
|
||||||
begin
|
|
||||||
dlgOkError('html documentation cannot be found for "' + Identifier + '"');
|
|
||||||
end;
|
|
||||||
var
|
var
|
||||||
str: string;
|
str: string;
|
||||||
pth: string;
|
pth: string;
|
||||||
|
rac: string;
|
||||||
idt: string = '';
|
idt: string = '';
|
||||||
pos: integer;
|
pos: integer;
|
||||||
len: integer;
|
len: integer;
|
||||||
|
@ -1703,11 +1700,31 @@ var
|
||||||
rng: TStringRange = (ptr:nil; pos:0; len: 0);
|
rng: TStringRange = (ptr:nil; pos:0; len: 0);
|
||||||
i: integer;
|
i: integer;
|
||||||
linelen: integer;
|
linelen: integer;
|
||||||
|
procedure errorMessage(const msg: string);
|
||||||
|
begin
|
||||||
|
// parameter for doc racine is a folder
|
||||||
|
if rac[rac.length] in ['/','\'] then
|
||||||
|
rac += 'index.html'
|
||||||
|
else if rac.dirExists then
|
||||||
|
rac += DirectorySeparator + 'index.html'
|
||||||
|
else
|
||||||
|
rac += '/' + 'index.html';
|
||||||
|
|
||||||
|
if dlgYesNo(format('%s.%sOpen the documentation index anyway ?',
|
||||||
|
[msg, LineEnding])) = mrYes then
|
||||||
|
OpenURL(rac);
|
||||||
|
end;
|
||||||
begin
|
begin
|
||||||
|
if fPhobosDocRoot.dirExists then
|
||||||
|
rac := 'file://' + fPhobosDocRoot
|
||||||
|
else
|
||||||
|
rac := fPhobosDocRoot;
|
||||||
|
if rac.isEmpty then
|
||||||
|
rac := 'https://dlang.org/phobos/index.html';
|
||||||
DcdWrapper.getDeclFromCursor(str, pos);
|
DcdWrapper.getDeclFromCursor(str, pos);
|
||||||
if not str.fileExists then
|
if not str.fileExists then
|
||||||
begin
|
begin
|
||||||
errorMessage;
|
errorMessage('The source where the symbol is declared is not existing');
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
// verify that the decl is in phobos
|
// verify that the decl is in phobos
|
||||||
|
@ -1716,7 +1733,8 @@ begin
|
||||||
begin
|
begin
|
||||||
if pth.extractFilePath = pth then
|
if pth.extractFilePath = pth then
|
||||||
begin
|
begin
|
||||||
errorMessage;
|
errorMessage('The source where the symbol is declared does not seem' +
|
||||||
|
' to be part of Phobos or the D runtime');
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
pth := pth.extractFilePath;
|
pth := pth.extractFilePath;
|
||||||
|
@ -1753,7 +1771,10 @@ begin
|
||||||
while true do
|
while true do
|
||||||
begin
|
begin
|
||||||
if rng.empty then
|
if rng.empty then
|
||||||
|
begin
|
||||||
|
errorMessage('Failed to determine the matching HTML file');
|
||||||
exit;
|
exit;
|
||||||
|
end;
|
||||||
rng.popUntil(DirectorySeparator);
|
rng.popUntil(DirectorySeparator);
|
||||||
if not rng.empty then
|
if not rng.empty then
|
||||||
rng.popFront;
|
rng.popFront;
|
||||||
|
@ -1761,10 +1782,7 @@ begin
|
||||||
or rng.startsWith('etc' + DirectorySeparator) then
|
or rng.startsWith('etc' + DirectorySeparator) then
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
if fPhobosDocRoot.dirExists then
|
pth := rac;
|
||||||
pth := 'file://' + fPhobosDocRoot
|
|
||||||
else
|
|
||||||
pth := fPhobosDocRoot;
|
|
||||||
while not rng.empty do
|
while not rng.empty do
|
||||||
begin
|
begin
|
||||||
pth += rng.takeUntil([DirectorySeparator, '.']).yield;
|
pth += rng.takeUntil([DirectorySeparator, '.']).yield;
|
||||||
|
|
Loading…
Reference in New Issue