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)
|
||||
{
|
||||
LfmString ~= " item\n";
|
||||
LfmString ~= " \r\n item\r\n";
|
||||
foreach(member; EnumMembers!TodoField)
|
||||
if (fFields[member].length)
|
||||
LfmString ~= format(" %s = '%s'\n", to!string(member), fFields[member]);
|
||||
LfmString ~= " end\n";
|
||||
LfmString ~= format(" %s = '%s'\r\n", to!string(member), fFields[member]);
|
||||
LfmString ~= " end";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,15 +134,10 @@ void main(string[] args)
|
|||
// serialize the items using the pascal component streaming text format
|
||||
foreach(todoItem; todoItems) todoItem.serialize(LfmString);
|
||||
|
||||
// separates the data sent in procOutput() from those sent in procTerminated()
|
||||
// TODO-cbugfix: find a way to determine if stdout has been written
|
||||
if (stdout.size != 0) {
|
||||
stdout.flush;
|
||||
readln;
|
||||
}
|
||||
//TODO: NEVER call writeln() in this program otherwise the widget cant interpret the output as LFM
|
||||
|
||||
// the widget has the LFM script in the output, it reads in procTerminated()
|
||||
if (LfmString.length) writefln("object TTodoItems\n items = <\n%s>\nend", LfmString);
|
||||
// the widget has the LFM script in the output
|
||||
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
|
||||
|
@ -150,12 +145,13 @@ void main(string[] args)
|
|||
{
|
||||
if (atok.type != (tok!"comment"))
|
||||
return;
|
||||
if (atok.text.length < 3)
|
||||
auto text = atok.text.strip;
|
||||
if (text.length < 3)
|
||||
return;
|
||||
if (atok.text[1] == '*' || atok.text[1] == '+' || atok.text[2] == '/')
|
||||
if (text[1] == '*' || text[1] == '+' || text[2] == '/')
|
||||
return;
|
||||
|
||||
auto text = atok.text[2..$];
|
||||
text = text[2..$];
|
||||
string identifier;
|
||||
bool isTodoComment;
|
||||
size_t pos;
|
||||
|
@ -214,4 +210,4 @@ void main(string[] args)
|
|||
// TODO: set this property as const() to set it read only.
|
||||
// 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-cfeature-sDone: save this property in the inifile.
|
||||
|
|
|
@ -82,8 +82,8 @@ type
|
|||
function getContext: TTodoContext;
|
||||
procedure killToolProcess;
|
||||
procedure callToolProcess;
|
||||
procedure procTerminated(sender: TObject);
|
||||
procedure procOutput(sender: TObject);
|
||||
procedure procOutputDbg(sender: TObject);
|
||||
procedure clearTodoList;
|
||||
procedure fillTodoList;
|
||||
procedure lstItemsDoubleClick(sender: TObject);
|
||||
|
@ -278,10 +278,18 @@ begin
|
|||
// process parameter
|
||||
fToolProcess := TCheckedAsyncProcess.Create(nil);
|
||||
fToolProcess.Executable := ToolExeName;
|
||||
fToolProcess.Options := [poUsePipes, poStderrToOutPut];
|
||||
fToolProcess.Options := [poUsePipes];
|
||||
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;
|
||||
|
||||
// files passed to the tool argument
|
||||
if ctxt = tcProject then fToolProcess.Parameters.Add(symbolExpander.get('<CPFS>'))
|
||||
else fToolProcess.Parameters.AddText(symbolExpander.get('<CFF>'));
|
||||
|
@ -289,16 +297,15 @@ begin
|
|||
fToolProcess.Execute;
|
||||
end;
|
||||
|
||||
procedure TCETodoListWidget.procOutput(sender: TObject);
|
||||
procedure TCETodoListWidget.procOutputDbg(sender: TObject);
|
||||
var
|
||||
str: TStringList;
|
||||
msg: string;
|
||||
ctxt: TTodoContext;
|
||||
begin
|
||||
subjLmFromString(fLogMessager, 'called even if nothing in output', fProj, amcProj, amkAuto);
|
||||
str := TStringList.Create;
|
||||
try
|
||||
processOutputToStrings(TAsyncProcess(fToolProcess), str);
|
||||
processOutputToStrings(fToolProcess, str);
|
||||
ctxt := getContext;
|
||||
for msg in str do case ctxt of
|
||||
tcNone: subjLmFromString(fLogMessager, msg, nil, amcMisc, amkAuto);
|
||||
|
@ -308,10 +315,9 @@ begin
|
|||
finally
|
||||
str.Free;
|
||||
end;
|
||||
fToolProcess.Input.WriteByte($0A);
|
||||
end;
|
||||
|
||||
procedure TCETodoListWidget.procTerminated(sender: TObject);
|
||||
procedure TCETodoListWidget.procOutput(sender: TObject);
|
||||
var
|
||||
str: TMemoryStream;
|
||||
cnt: Integer;
|
||||
|
|
Loading…
Reference in New Issue