mirror of https://gitlab.com/basile.b/dexed.git
fixed issues encountered when many TODO comments
e.g: std.process, now they are all listed
This commit is contained in:
parent
b214e1bbbd
commit
a277fc1e45
|
@ -93,11 +93,11 @@ private struct TodoItem
|
||||||
*/
|
*/
|
||||||
@safe public void serialize(ref string LfmString)
|
@safe public void serialize(ref string LfmString)
|
||||||
{
|
{
|
||||||
LfmString ~= " item\n";
|
LfmString ~= " \r\n item\r\n";
|
||||||
foreach(member; EnumMembers!TodoField)
|
foreach(member; EnumMembers!TodoField)
|
||||||
if (fFields[member].length)
|
if (fFields[member].length)
|
||||||
LfmString ~= format(" %s = '%s'\n", to!string(member), fFields[member]);
|
LfmString ~= format(" %s = '%s'\r\n", to!string(member), fFields[member]);
|
||||||
LfmString ~= " end\n";
|
LfmString ~= " end";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,15 +134,10 @@ void main(string[] args)
|
||||||
// serialize the items using the pascal component streaming text format
|
// serialize the items using the pascal component streaming text format
|
||||||
foreach(todoItem; todoItems) todoItem.serialize(LfmString);
|
foreach(todoItem; todoItems) todoItem.serialize(LfmString);
|
||||||
|
|
||||||
// separates the data sent in procOutput() from those sent in procTerminated()
|
//TODO: NEVER call writeln() in this program otherwise the widget cant interpret the output as LFM
|
||||||
// TODO-cbugfix: find a way to determine if stdout has been written
|
|
||||||
if (stdout.size != 0) {
|
|
||||||
stdout.flush;
|
|
||||||
readln;
|
|
||||||
}
|
|
||||||
|
|
||||||
// the widget has the LFM script in the output, it reads in procTerminated()
|
// the widget has the LFM script in the output
|
||||||
if (LfmString.length) writefln("object TTodoItems\n items = <\n%s>\nend", LfmString);
|
if (LfmString.length) writefln("object TTodoItems\r\n items = <%s>\r\nend\r\n", LfmString);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Try to transforms a Token into a a TODO item
|
/// Try to transforms a Token into a a TODO item
|
||||||
|
@ -150,12 +145,13 @@ void main(string[] args)
|
||||||
{
|
{
|
||||||
if (atok.type != (tok!"comment"))
|
if (atok.type != (tok!"comment"))
|
||||||
return;
|
return;
|
||||||
if (atok.text.length < 3)
|
auto text = atok.text.strip;
|
||||||
|
if (text.length < 3)
|
||||||
return;
|
return;
|
||||||
if (atok.text[1] == '*' || atok.text[1] == '+' || atok.text[2] == '/')
|
if (text[1] == '*' || text[1] == '+' || text[2] == '/')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto text = atok.text[2..$];
|
text = text[2..$];
|
||||||
string identifier;
|
string identifier;
|
||||||
bool isTodoComment;
|
bool isTodoComment;
|
||||||
size_t pos;
|
size_t pos;
|
||||||
|
@ -214,4 +210,4 @@ void main(string[] args)
|
||||||
// TODO: set this property as const() to set it read only.
|
// TODO: set this property as const() to set it read only.
|
||||||
// TODO-cfeature-sDone: save this property in the inifile.
|
// TODO-cfeature-sDone: save this property in the inifile.
|
||||||
// TODO-cannnotations-p8: annotates the member of the module as @safe and if possible nothrow.
|
// TODO-cannnotations-p8: annotates the member of the module as @safe and if possible nothrow.
|
||||||
|
// TODO-cfeature-sDone: save this property in the inifile.
|
||||||
|
|
|
@ -82,8 +82,8 @@ type
|
||||||
function getContext: TTodoContext;
|
function getContext: TTodoContext;
|
||||||
procedure killToolProcess;
|
procedure killToolProcess;
|
||||||
procedure callToolProcess;
|
procedure callToolProcess;
|
||||||
procedure procTerminated(sender: TObject);
|
|
||||||
procedure procOutput(sender: TObject);
|
procedure procOutput(sender: TObject);
|
||||||
|
procedure procOutputDbg(sender: TObject);
|
||||||
procedure clearTodoList;
|
procedure clearTodoList;
|
||||||
procedure fillTodoList;
|
procedure fillTodoList;
|
||||||
procedure lstItemsDoubleClick(sender: TObject);
|
procedure lstItemsDoubleClick(sender: TObject);
|
||||||
|
@ -278,10 +278,18 @@ begin
|
||||||
// process parameter
|
// process parameter
|
||||||
fToolProcess := TCheckedAsyncProcess.Create(nil);
|
fToolProcess := TCheckedAsyncProcess.Create(nil);
|
||||||
fToolProcess.Executable := ToolExeName;
|
fToolProcess.Executable := ToolExeName;
|
||||||
fToolProcess.Options := [poUsePipes, poStderrToOutPut];
|
fToolProcess.Options := [poUsePipes];
|
||||||
fToolProcess.ShowWindow := swoHIDE;
|
fToolProcess.ShowWindow := swoHIDE;
|
||||||
fToolProcess.OnTerminate := @procTerminated;
|
|
||||||
|
// Something not quite clear:
|
||||||
|
// --------------------------
|
||||||
|
// actually the two events can be called, depending
|
||||||
|
// on the amount of data in the output.
|
||||||
|
// many: OnReadData is called.
|
||||||
|
// few: OnTerminate is called.
|
||||||
|
fToolProcess.OnTerminate := @procOutput;
|
||||||
fToolProcess.OnReadData := @procOutput;
|
fToolProcess.OnReadData := @procOutput;
|
||||||
|
|
||||||
// files passed to the tool argument
|
// files passed to the tool argument
|
||||||
if ctxt = tcProject then fToolProcess.Parameters.Add(symbolExpander.get('<CPFS>'))
|
if ctxt = tcProject then fToolProcess.Parameters.Add(symbolExpander.get('<CPFS>'))
|
||||||
else fToolProcess.Parameters.AddText(symbolExpander.get('<CFF>'));
|
else fToolProcess.Parameters.AddText(symbolExpander.get('<CFF>'));
|
||||||
|
@ -289,16 +297,15 @@ begin
|
||||||
fToolProcess.Execute;
|
fToolProcess.Execute;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCETodoListWidget.procOutput(sender: TObject);
|
procedure TCETodoListWidget.procOutputDbg(sender: TObject);
|
||||||
var
|
var
|
||||||
str: TStringList;
|
str: TStringList;
|
||||||
msg: string;
|
msg: string;
|
||||||
ctxt: TTodoContext;
|
ctxt: TTodoContext;
|
||||||
begin
|
begin
|
||||||
subjLmFromString(fLogMessager, 'called even if nothing in output', fProj, amcProj, amkAuto);
|
|
||||||
str := TStringList.Create;
|
str := TStringList.Create;
|
||||||
try
|
try
|
||||||
processOutputToStrings(TAsyncProcess(fToolProcess), str);
|
processOutputToStrings(fToolProcess, str);
|
||||||
ctxt := getContext;
|
ctxt := getContext;
|
||||||
for msg in str do case ctxt of
|
for msg in str do case ctxt of
|
||||||
tcNone: subjLmFromString(fLogMessager, msg, nil, amcMisc, amkAuto);
|
tcNone: subjLmFromString(fLogMessager, msg, nil, amcMisc, amkAuto);
|
||||||
|
@ -308,10 +315,9 @@ begin
|
||||||
finally
|
finally
|
||||||
str.Free;
|
str.Free;
|
||||||
end;
|
end;
|
||||||
fToolProcess.Input.WriteByte($0A);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCETodoListWidget.procTerminated(sender: TObject);
|
procedure TCETodoListWidget.procOutput(sender: TObject);
|
||||||
var
|
var
|
||||||
str: TMemoryStream;
|
str: TMemoryStream;
|
||||||
cnt: Integer;
|
cnt: Integer;
|
||||||
|
|
Loading…
Reference in New Issue