SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => SlickEdit User Macros => Topic started by: vivitron on April 06, 2010, 12:13:01 am

Title: AutoLint
Post by: vivitron on April 06, 2010, 12:13:01 am
Command Name:
run-lint - Executes the configured lint command against the current buffer. Configuration is by workspace and filetype.

Written For:
SlickEdit 15.0.0.3 (should work in v14)

Description:
One of my favorite features of other editors is their ability to detect syntax errors.  I think this is huge with languages like javascript that are interpreted at runtime.  There are many third party tools designed to check the syntax of a file.  We already have project specified commands we can run, but this is for configuring a lint by file type.  I've configured this to run lint on javascript files and C# files.  The biggest trouble is finding the parser to spit out the data.  The Mono compiler supports a --parse flag (not always documented) that will just parse the file.  I also used Javascript Lint (first result on Google) to parse the JS files.

Limitations:
I rely on executing "vs -#set_error_markers" to populate the markers.  If there is more than one editor running, this will probably fail. I considered hooking into to the vsbuild system.   Not tested on UNIX based systems.  

Installation:

Credits:
I borrowed from as many examples as I could find on these forums.  It's hard to "get started" with the macros.  The author of gitmanager provided the best examples for me.  Thank you for all the examples!

I'm sure this code is far from perfect... I had a simple task that I needed a simple solution for. I just hope it helps someone else out.

Thanks!

Update on 9/26/2010:
I switched to Ubuntu and found things didn't work well on linux, so I've added some configuration parameters:
Title: Re: AutoLint
Post by: rickmellor on August 07, 2010, 04:03:21 am
Thank you for sharing this!  I was looking for a PHP lint macro and was able to get this to do the job by adding a line to the .ini file:

html=call C:\php-5.2.14-Win32\php.exe -l "%f"

-Rick
Title: Re: AutoLint
Post by: vivitron on August 08, 2010, 04:02:13 pm
That's great... glad it helped!
Title: Re: AutoLint
Post by: DownInFront on April 10, 2013, 07:10:28 pm
Thank you for sharing this!  I was looking for a Windows PC-Lint macro for my C files and was able to get this to do the job too!

I adjusted slicklint.ini for use with windows as you recommended in that file and I also added the following:

c="r:\tools\lint\lint-nt"  -u -b -i"r:\tools\lint" %wsource/options.lnt "%f"