Author Topic: AutoLint  (Read 6896 times)

vivitron

  • Senior Community Member
  • Posts: 162
  • Hero Points: 10
AutoLint
« 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:
  • Load the autolint.e macro
  • Copy & Customize the slicklint.ini file to your workspace directory
  • If autolint on save is enabled, then it should execute in the build window when you save a file.  You can always execute the lint command via run-lint

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:
  • VSCommand - Specify the path to the vs binary
  • CommandSeperator - Specify how multiple commands should be chained (i.e. ; for bash)
« Last Edit: September 27, 2010, 02:38:03 am by vivitron »

rickmellor

  • New Community Member
  • Posts: 1
  • Hero Points: 0
Re: AutoLint
« Reply #1 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

vivitron

  • Senior Community Member
  • Posts: 162
  • Hero Points: 10
Re: AutoLint
« Reply #2 on: August 08, 2010, 04:02:13 pm »
That's great... glad it helped!

DownInFront

  • Community Member
  • Posts: 5
  • Hero Points: 0
Re: AutoLint
« Reply #3 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"