Version française
Home     About     Download     Resources     Contact us    
Browse thread
Announce: annot looks up types in *.annot files
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christian Lindig <lindig@c...>
Subject: Announce: annot looks up types in *.annot files

To lookup types of identifiers from within Vim, I have implemented a 
small tool in Ocaml called annot:

	$ annot -type 30 20 main.annot
   	string list

Given a cursor position (line 30, column 20) it looks up the type 
annotation for that position in main.annot. It is trivial to hook this 
to a key in Vim, and probably most other editors.

function! OCamlType()
     let col  = col('.')
     let line = line('.')
     let file = expand("%:p:r")
     echo system("annot -n -type " . line . " " . col . " " . file . 
".annot")
endfunction
map ,t :call OCamlType()<return>

I'm well aware that Vim and Emacs have their own solutions, using their 
own scripting languages, but I think it is better to have one general 
solution.

You can download the tool from my subversion repository; it is released 
under a BSD-style license.

	svn co svn://svn.vistabella.de/annot

The tool should build on Unix systems, comes with ./configure, and a 
manual page. Let me know if there are any problems. Of course, positive 
feedback is also welcome.

-- Christian

--
http://www.st.cs.uni-sb.de/~lindig/