Is there already a way in Xcode to map from a generic command line tool's output to line numbers and messages so that when running e.g. cpplint you can have it mapped to the graphical text editor?
I though of writing a plugin for this but it seems overkill, I imagined that this kind of generic functionality had already been developed, if not already included in Xcode.
In case anyone stumbles upon this:
In Xcode 7 it's actually very easy to accomplish this behaviour. Add a "Run Script Phase" to the "Build Phases" of your target, as described very well on this site here. Then use the following command to run cpplint.py:
/usr/local/bin/cpplint.py ./${TARGET_NAME}/*
Adjust the path to cpplint.py to your situation. When cpplint.py encounters an error, Xcode should highlight the specific line in the editor like this:
Hint: If you want to modify the command above, you can observe the entire output of the script in Xcode on the "Report Navigator". To view the "Report Navigator" press either ⌘8 or click on View > Navigators > Show Report Navigator, then select the last build on the right pane and activate All Messages on the log pane. See also the answer of the the following post: Added Run Script phase to Xcode, but nothing happens.
Related
I just got Visual Studio, and every time I try running the code, a message pops up and says "code language not supported or defined. This happens with any language I try to use. How do I fix it?
In the bottom right corner of the window notice where it says "plain text", Click this and you should see all the available language options. It's probably set to autodetect right now.
STEPS to follow:
1) Install the "CODE RUNNER" extension in Visual Studio (VS) (if you have not done so, yet).
2) After that, go to VS "Settings" (by clicking the wheel) and, in the search field on the top, enter: "run code".
3) You'll see, to the right, all the options available for "Code Runner" settings. Scroll down, and you'll see a field that says,
Code-runner: Executor Map By File Extension.
Set the executor of each file extension.
4) Click on: "Edit in Settings.json".
5) Then, scroll down until you see "code-runner.executorMapByFileExtension" field brackets. You'll be able to see all the files extensions (e.g., ".vb", ".scala", etc.) and the corresponding executor application that run such files after the colons, to the right.
6) If you don't see the extension for the file you're trying to run (e.g., ".js"), just enter it following the same (json) format as the ones above, with the executor program (that you need to know) that runs it, to the right.
EXAMPLE: in the Mac, for a javascript (JS) file with extension ".js" (assuming you've already installed NODE, the JS executor app), you should enter a line at the end (inside the last bracket) such as,
".js": "node"
(NOTE: make sure you put a coma (,) at the end of the previous line, right before your addition)
7) SAVE your edit, and run your program by clicking the arrow on the top right corner of Visual Studio window. Your program output will be shown on the OUTPUT tab in the section below.
Here is a solution:
Close your folder from the Explorer and reopen and run your file. It solves the issue
You saw that error message in vscode because you probably used the shortcut Alt+Ctrl+N to run the code while the output terminal is selected instead of the script. try click the mouse in the script area and do it again, it should work. if the run the code by pressing the button on the top right corner and you still see the same error msg that means you need to check .Jason settings.
Read the language support page for MS Visual Studio: https://code.visualstudio.com/docs/languages/overview
You can define a languages in the files.associations setting.
If you haven't setup language support:
https://code.visualstudio.com/docs/setup/setup-overview
Option 1:
In the right bottom of the window notice where it says "plain text", Click this and you should see all the available options. It probably provides the available list of language .
Option 2: Uninstall the current version and install stable version of visual studio code
On my case, I follow first option at first but I could able to solve the problem so I uninstall the visual studio code and solving the problem using stable version. Try once I may work on your case
I want to redirect output from our code review tool that we are writing in VS2010, so that it's messages are parsed by Vs2010 and we can click on them to goto file, line, column.
I vaguely remember learing about this in vs2005, you output your text to a certain kind of window, with the exact format below, and then vs would parse the message and you could click on it to goto the specific location...
D:\Project Files\CIS3G\Webapp_Test_BLL\Evaluation\Reports\TestEvaluationHistoryBLL.cs(27,44): warning CS0649: Error text
It was constructed thusly :
full file path:[error or warning type]:error message
Then it just worked "magically"..
But this is all I can remember from a conversation ~10 years ago about how to do this.
Does anyone remember what I'm talking about and can direct me to information about how to make this work with output from a tool we write to work within visual studio 2010?
Maybe a tutorial?
This post:
Formatting the output of a custom tool so I can double click an error in Visual Studio and the file opens
Talks about doing it in the build, but I'd like to be able to run the code review tool independantly and get it to work too...
You've pretty much got it right in your question.
As an example, create a file in your temp directory (in a command prompt do echo %temp% to find it) called test.bat
Add the following to test.bat:
#echo D:\Project Files\CIS3G\Webapp_Test_BLL\Evaluation\Reports\TestEvaluationHistoryBLL.cs(27,44): warning CS0649: Error text
Now in VS10, select Tools->External Tools.... In the new window, select Add.
In the Command: field, enter %temp%\test.bat
Select Use Output window and click OK.
Your new tool should now show up in VS10's Tools menu. If you click on it, your Output window should display a clickable message, which will open "D:\Project Files\CIS3G\Webapp_Test_BLL\Evaluation\Reports\TestEvaluationHistoryBLL.cs" if it exists, and will put the cursor on line 27 if it exists (if not, line 1) at column 44 if it exists (if not, column 1).
You can go further and add a shortcut key to your custom tool.
Select Tools->Options...->Environment->Keyboard. Find your tool in the list of commands. It will show as Tools.ExternalCommand[x] where [x] is its position in the list of External Tools. Enter your chosen shortcut key(s) in the Press shortcut keys: box and click OK.
Here is an article on doing this written in 2004 that still applies today:
http://www.codeproject.com/Articles/6176/Using-the-Output-Window-in-DevStudio
Yes, I wrote it, but as was pointed out earlier, there is nothing particularly magic about this. The article mentions VC6 and VC7, but I still use this technique in VS2005, VS2008, and VS2010 for the output of PC-Lint.
Is there a way in Xcode to have your software open up the console for you? I would like to have it when my code compiles and runs in Debug to have the console open up automatically but in release for it to not open.
Thanks in advance.
A common way to achieve this is :
Open a new tab, and rename it 'Console' (or what name you want)
In this tab, show only the panes you want (in your case the console)
Go to Preferences>Behaviors
Tell Xcode to 'Show tab' and give it the name you set in 1. (you can set this at various moments, when build starts, or when app runs).
Now, each you will either compile or run your app, Xcode will switch to the tab you have set in Prefs.
You dont use code, you go to xcode pref's and do it there
This is where I came for the answer given and marked correct (although it's not clear it was what the asker quite wanted).
Arguably, a simpler version of the answer given is to set the Behaviors preferences to show the Debugger when a run starts. With the settings in the image below, this opens up the console (or the console + variable views or the variables view, depending on how it was last set - that's what 'Current Views' means).
Is it possible to run a batch file as a menu item in studio 2008?
Yes, go to Tools | External Tools in the menus and add your batch file as the Command. You can also pass in any arguments that you want such as the build target, project directories, etc.
Once you do this, your batch file will appear as one of the items on your tools menu. If you want, you can then add a toolbar button for it by going Tools | Customize | Tools and dragging the External Command # that matches your tool to the toolbar. You will then want to change it to an icon and select an image for it.
The tools are numbered 1 based in the order they appear in the menu.
Run batch files in VS Solution Explorer directly
This is much better than having external tool since you can execute a batch file simply by double clicking on it in solution explorer just as if you were opening a code file. I've written a blog post about it that will help you lots to configure it and of course use it.
A sidenote
You've asked this question 2 years ago, but I see that nobody mentioned this technique so I'm providing this answer for any future reference. I hope it gets upvoted, so it will be near the top for readers to see.
Use "Tools"/"External Tools..." menu item and add your bat-file to "Tools" menu
As A refinement to the given answer:
Say your project/solution have several BAT that are project specific - you wouldn't want to run one from another project - that's what could happen with the above answer - because you have hard wired the path to the bat.
Just set up one external tool nameed "Run BAT", sets its Command to $(ItemPath), and set the initial directory to $(ItemDirectory), The dialog will whinge that this is not a real executable - but ignore that.
Tie the tool to a button if you want.
Now to run the BAT of choice from the project or solution - just open the .bat for editing and select the "Run BAT" external tool.
you could also set the "use output" option as well and the bats output will be in the output window.
Unfortunately it looks like for various reasons I'm going to have to use Visual Studio 6 instead of a newer version of VS.
It's been a long time since I've used it. I'm looking through its menus and don't see any obvious way to set up any custom build steps (pre-build, post-build, pre-link... anything would help actually).
Can anyone give me instructions on how to set up steps like this?
Open your project, then open the Project Settings screen (Project → Settings or ALT-F7). Alternatively, right click on a file in the FileView and select Settings.
From the Project Settings screen, go to the General tab and check "Always use custom build step". This means that the file you just chose will be an input file for a custom build step. From the "Custom Build" tab you can then give the commands to run and specify what files will be generated.
For pre-link, post-build and such, select an executable (or library) from the Project Settings screen. Then use the little arrow button to scroll to the rightmost tabs. From there you'll find the Pre-link and Post-build steps.
It's quite simple, really, I'm sure this is enough to get you started.