Bug 340303 - new language service: ast annotators
Summary: new language service: ast annotators
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: IMP (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Robert M. Fuhrer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-17 08:22 EDT by Jurgen Vinju CLA
Modified: 2014-01-09 15:04 EST (History)
0 users

See Also:


Attachments
A patch for imp.runtime, relative to the project. (37.68 KB, text/plain)
2011-03-17 08:22 EDT, Jurgen Vinju CLA
no flags Details
new patch without the new feature, but with a clean up of parser schedular (20.11 KB, application/octet-stream)
2011-03-17 12:41 EDT, Jurgen Vinju CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jurgen Vinju CLA 2011-03-17 08:22:35 EDT
Created attachment 191407 [details]
A patch for imp.runtime, relative to the project.

The following patch introduces a new IMP language service: "annotator". 
  * An annotator is an ast processor that may quickly modify an ast. 
  * Annotators are run just after parsing, but before the other editor services are run. This allows these services to use information provided by the annotator.
  * Annotators are given an IMessageHandler so as to be able to put error markers in an editor

The last point is the critical functionality. Normal editor services are not able to do this due to race conditions. The explanation is that ParserSchedular is run as an asyncronous job. Eclipse does not guarantee that each call to run() is executed in order, so a language service can NOT by itself manage editor annotations (a previous run may throw away the markers that the next run is just adding).

The second point is interesting, but can currently not be implemented safely. The reason is that the ast reference is stored in the parse controller. The client is therefore responsible for managing the state of the ast. The functionality of passing the result of annotating to other language services can not be implemented safely by IMP. I recommend changing this, but I'll file another report.

This patch also includes a number of clean up operations in ParserSchedular. Out-of-date comments where removed as well as some superfluous comments. Also, some dead code was removed regarding the "level" of analysis that is needed. More simplification is possible here. We should design real system for staging language services and remove the current code.
Comment 1 Jurgen Vinju CLA 2011-03-17 08:25:36 EDT
Perhaps the changes to remove the analysis levels should not be included, please ignore for this bug report. I'll make another patch that still has them when the time comes.
Comment 2 Jurgen Vinju CLA 2011-03-17 12:41:55 EDT
Created attachment 191442 [details]
new patch without the new feature, but with a clean up of parser schedular

some more hidden changes in this patch:
  * makes parsing a job that is visible to the user (allowing the user to cancel it for example)
  * makes IModelListeners more robust by wrapping each execution of a listener with try/catch