none
How would you solve this?

    Question

  • Hi everyone, sorry this is a long one.

    I've been trying to figure out how to approach this problem, but I'm still not sure how to solve it, so I was hoping someone here with more experience would be able to guide me in the right direction. Let me explain what I'm trying to do.

    I'm trying to integrate an extended Java language into Visual Studio. The language is extended by allowing preprocessing directives that have the form //#directiveName, to be used in the code, which will then be preprocessed before compiling. Right now, I've created a custom MSBuildTask that preprocesses the source, and copies it into another folder along with a project file, and the preprocessed source is then build. This is working fine, however, there are twoproblems associated with this solution that I'm not sure how to solve.

    Firstly, because the source I'm building is not the source I'm editing, Visual Studio is not able to break at the breakpoints I add. I'm guessing a way to solve this would be to catch when a breakpoint is set, and then set it in the preprocessed file instead of the file being edited. Not sure how to do this, but I assume it would work if I figure it out.

    Secondly, I have a problem with the syntax of one of the preprocesser directives. A preprocessor variable is defined by using //#define variable = value, and used with the following syntax ${variable}. The problem is that the preprocessor variables can be used directly in the source, which means that the following is valid: int a = ${variable};
    Right now I'm using the J# editor to edit my files, so the above syntax is invalid and therefore the automatic syntax checking (CodeSense?) is reporting errors anywhere these are found. To solve this, my idea was do a quick fix by creating a J# editor and just disable the automatic syntax checking. A more valid fix would be to implement a Language Service, but due to time restrictions, a quick fix would be better.

    How would you approach these problems? and if my solutions would work, could you point me to articles that might lead me in the right direction?

    Hope you can help,
    Morten Sneftrup Pedersen
    Monday, January 21, 2008 11:45 AM