Language service - automatic document format problem RRS feed

  • Question

  • Hello,

    I'm developing language service for Visual Studio 2010. I'm using Visual studio sdk and Ook language sample, i managed to create full syntax highlighting, but I have found unexpected bug while testing. It seems since Visual Studio uses XML editor as default for unknown file types, Visual Studio, in some cases, converts my code to XML content. For simplicity I will demonstrate it on the default Ook language project.

    This is how a simple Ook file looks in editor: Image

    This is the problem, after i edited Ook file: Image

    As You can see Visual Studio changed document type to XML. So, I'm trying to change document type manually, like this: Pastebin. After that I'm getting back Ook highlighting, but document becomes not editable. I'm doing this wrong right? So the question is how properly convert content from XML type to the Ook ( or any other ) type?


    Thursday, July 14, 2011 3:32 PM

All replies

  • Hello,

    For some internet issue, I can't see your picture. Could you upload it to live sky drive and share the link to us?

    Normally, we can right click the file in solution explore and click "Open with" to use another editor to open the file. You are also allowed to set the new selected editor as default, therefore you can always use the editor to open the file.

    It seems you didn't register your OOK file to the Visual Studio and define a default editor for it. You can open the regedit and navigate to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config\Languages\File Extensions, here lists all supported file extensions, you can create a subkey for your OOK file and add the reference of the GUID of the current edit as the default value. You can put these actions into your pkgdef file.

    If I misunderstand you, please let me know.


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, July 19, 2011 7:38 AM
  • Hi,

    Thank You for help.

    Sorry for a late reply, I was checking Your solution. Currently, I applied default editor for ook language throught Tools->Options->Text Editor->File extensions->".ook" "Source Code (Text) Editor With Encoding". It does solve the problem I had with highlighting, but now each time I'm about to open ook file Visual Studio asks for encoding type. Can I somehow create/find custom editor identifier for Visual Studio based on UTF-8 text editor?

    Wednesday, July 20, 2011 5:38 PM