How to Bring up IDE Editor Programmatically

VERSION 5 Published

Created on:Sep 27, 2007 10:36 AM by curl - Last Modified:  Apr 16, 2008 6:37 AM by cbarber

When building external development tools for Curl you often want the ability to programmatically bring up a particular file in the IDE editor. Although there is no publicly documented way to do this, it can be done by browsing to a special "curl://edit/" URL. The "curl://edit/" scheme has the format:

curl://edit/ + actual-url + # + line number

For instance, the URL "curl://edit/file:///c:/tmp/foo.curl#123" should open the file "c:/tmp/foo.curl" in the editor at line 123 when passed to the 'browse-url' function. This will only work if the Curl IDE is installed.

Based on this, here is a simple function that will bring up the editor for the specified url and line:

{define-proc public {edit-url url:Url, line:int = -1}:void
    {browse-url
        {parse-url
            {format
                "curl://edit/%s#%s",
                url.name, line
            }
        }
    }
}    
Average User Rating
(2 ratings)