|
Jacek Gajek wrote: No, i did not forget.
That does not fit well with the code you have shown.
I'm afraid I can't provide any more help, unless you show actual code.
|
|
|
|
|
Luc Pattyn wrote: That does not fit well with the code you have shown.
I meant I hadn't forgotten to add apriopriate lines after reading your post, of course . Here is the full code.
public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
{
handled = false;
if(executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
{
if(commandName == "LatexAddin.Connect.LatexAddin")
{
Document doc = _applicationObject.ActiveDocument;
if (Path.GetExtension(doc.Name) == ".tex")
{
var p = new System.Diagnostics.Process();
var pinfo =new ProcessStartInfo
{
WindowStyle=ProcessWindowStyle.Hidden,
CreateNoWindow = true,
FileName = "pdflatex",
Arguments = string.Format("\"{0}\" -c-style-errors", doc.FullName),
WorkingDirectory = Path.GetDirectoryName(doc.FullName),
RedirectStandardError = true,
RedirectStandardOutput = true,
UseShellExecute = false
};
p.StartInfo = pinfo;
p.OutputDataReceived += p_OutputDataReceived;
p.ErrorDataReceived += p_ErrorDataReceived;
p.EnableRaisingEvents = true;
p.Exited += p_Exited;
p.Start();
}
return;
}
}
}
void p_ErrorDataReceived(object sender, DataReceivedEventArgs e)
{
Console.WriteLine("out:" + e.Data);
}
void p_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
Console.WriteLine("out:" + e.Data);
}
void p_Exited(object sender, EventArgs e)
{
Console.Beep();
((Process) sender).Exited -= p_Exited;
((Process)sender).OutputDataReceived -= p_OutputDataReceived;
((Process)sender).ErrorDataReceived -= p_ErrorDataReceived;
}
Greetings - Jacek
|
|
|
|
|
For something like that that I'm playing with this week, I use:
this.process.StartInfo.CreateNoWindow = false ;
this.process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden ; <-- may be unnecessary
this.process.StartInfo.UseShellExecute = false ;
this.process.StartInfo.RedirectStandardInput =
this.process.StartInfo.RedirectStandardOutput =
this.process.StartInfo.RedirectStandardError = true ;
this.process.Start() ;
And I don't use the events.
One of the problems[^] into which I ran is that reading from the error stream seems to block.
I now have a work-around for that, which I may submit in an article today.
|
|
|
|
|
Thanks.
PIEBALDconsult wrote: this.process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden ; <-- may be unnecessary
This one did the trick.
Greetings - Jacek
|
|
|
|
|
Hurray it worked! thank you so much
Solution:
process.Start();
process.ErrorDataReceived+=new DataReceivedEventHandler(process_ErrorDataReceived);
process.OutputDataReceived+=new DataReceivedEventHandler(process_OutputDataReceived);
process.BeginOutputReadLine();
process.BeginErrorReadLine();
Greetings - Jacek
|
|
|
|
|
right. You did peek at my article?
|
|
|
|
|
Umm, yeach. Thank you both then.
Greetings - Jacek
|
|
|
|
|
you're welcome.
|
|
|
|
|
Some time ago, I had to do something similar (executing a command line tool from an ASP.NET application and parsing the result).
The following code worked for me:
ProcessStartInfo info = new ProcessStartInfo(executablePath)
{
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardError = true,
RedirectStandardOutput = true
};
|
|
|
|
|
Suppose i am writing code in .net e.g
int i=10
then .net show me red line under the code where error occurs.we know the i have not apply semicolon at the end of syntax(int i=10;)
who handles these error while writing the source code???.
|
|
|
|
|
Well, you do! I'm not going to come over there, press the ';' key for you and then go back home again, am I?
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
if you are not able to under stand the query then pls never try to reply.
thanks for your suggestion.
|
|
|
|
|
It is your responsility to phrase the question correctly so other will understand you. If you can't do that and be civil, then please don't post here again.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Sharma Dinesh Kumar wrote: who handles these error while writing the source code???.
It is the responsibility of the developer to correct such errors.
Is this your first time programming?
Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
Sharma Dinesh Kumar wrote: who handles these error while writing the source code???
I'm going to guess that you want to know how the computer "knows" how to read C#-sourcecode and where that spellingchecker-thingy is getting it's intelligence from to recognize a syntax-error.
This assumption correct?
I are Troll
|
|
|
|
|
From whatever I could see in ILDasm, I guess VS uses Microsoft.VisualStudio.CSharp.Services.Language.dll to parse and validate the code we write.
|
|
|
|
|
Thank your for giving an answer instead of trolling, which was all that others was able to do <- oops, that was too strong a bit.
BTW I have another question. Is there a (simple?) way to implement a custom "spell-checking" as an add-in for VS? I would like to underline syntax errors in LateX documents.
Thanks --
Greetings - Jacek
|
|
|
|
|
Jacek Gajek wrote: instead of trolling, which was all that others was able to do.
All the other were valid responses. I don't know what you consider trolling. The OP was very poorly worded and did not communicate the question well at all.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
OK, sorry. I just found d@nish's answer most helpful, but I have overreacted. I apologise for my tactless remark.
Cheers/
Greetings - Jacek
|
|
|
|
|
|
harold aptroot wrote: Edit: before someone says "omg that's colouring not error checking"
Don't worry, someone is not one of these who do 'omg'.
Greetings - Jacek
|
|
|
|
|
Jacek Gajek wrote: Thank your for giving an answer instead of trolling, which was all that others was able to do.
This is because he used the information from everyone else to deduce that your question meant something very different from what you actually wrote.
|
|
|
|
|
Well not me actually, but you are right; I just need similar knowledge.
Greetings - Jacek
|
|
|
|
|
Do not spam the forums. Pick one and stick with it.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Sharma Dinesh Kumar wrote: .net show me red line
No it doesn't. Visual Studio does. Behind the scenes, there's a fairly continuous parsing/compilation process going on out of process, and it is this that raises this. It's this process that provides the smart tag functionality to allow you to add the implementation of an interface or identify that a method is missing, etc.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|