Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] Multiple languages in a single Scriptproject

great, thanks i'll try that.


On Mon, Jan 9, 2012 at 11:02 AM, Roy Ganor <roy@xxxxxxxx> wrote:

If you're using PHPStructuredEditor you can probably use org.eclipse.wst.sse.ui.semanticHighlighting extension point to add your own semantic highlighting (mark oocrrences) in the editor.

 

See this example in org.eclipse.php.ui:

 

    <extension point="org.eclipse.wst.sse.ui.semanticHighlighting">

        <highlighting

        class="org.eclipse.php.internal.ui.editor.highlighters.FunctionHighlighting"

        target="org.eclipse.php.core.phpsource">

        </highlighting>

    </extension>

 

Roy

From: dltk-dev-bounces@xxxxxxxxxxx [mailto:dltk-dev-bounces@xxxxxxxxxxx] On Behalf Of Robert Gr?ndler
Sent: Monday, January 09, 2012 10:44 AM
To: DLTK Developer Discussions
Subject: Re: [Dltk-dev] Multiple languages in a single Scriptproject

 

thanks for the explanation. I've tried already to add a higher priority to my language and then return my editor id,
but this screwed up the PHP editor. I get a lot of PHP NPEs when doing this, already during "PHP Tooling Initialization".

The thing is that the twig editor is working just fine by providing an org.eclipse.wst.sse.ui.editorConfiguration for my content-type,
which allows me to provide custom syntax coloring, codeassist, outline and folding.

What i tried to add is a "Mark occurrences" feature, which apparently is done in the Editor class itself. Is
this the only way to implement this feature? If there's another possibility i could simply use the editorConfiguration point
and don't override the PHPStructuredEditor at all.


cheers

-robert

On Mon, Jan 9, 2012 at 5:39 AM, Andrey Sobolev <andrey.sobolev@xxxxxxxxx> wrote:

Hi Robert,

Actually DLTK doesn't support multiple script languages per project.
Most of language detections are performed using project, so first nature specified in project are used.

There was a lot of discussions about how to support multiple languages in one project.
And actually we are not started any work on this topic.

Right now contributing of few script natures in same project will lead to model contained both languages.

So solve editor opening issue please do following:

Since DLTL open utility uses org.eclipse.dltk.ui.language extension to look for appropriate editor.
You need to contribute one for php nature with a bigger priority and override method IDLTKUILanguageToolkit.getEditorId().
So DLTK will open file in correct editor using returned editor id.
Also it probable will be required to override some other php extensions in same manner.

Best regards,
Andrey Sobolev.




On 09.01.2012 04:06, Robert Gründler wrote:

Hi,

my plugin contributes a content-type which is based on the php content type. It also contributes a Nature and a Language, which refer to that content-type.

My problem is, that when i double click a file of that language, the PHP editor is opened instead of my contributed editor.

It seems it recognizes my content-type, but associates it with the base content-type (PHP) instead of mine.

How does DLTK determine the correct language for a specific file extension?

regards

-robert

ps: here's the relevant parts of the plugin.xml:

   <extension point="org.eclipse.core.contenttype.contentTypes">
      <content-type
            base-type="org.eclipse.php.core.phpsource"
            file-extensions="twig"
            id="twigtemplate"
            name="Twig Template"
            priority="high">
      </content-type>
  </extension>

    <!-- the project nature -->
   <extension
         id="TwigNature"
         name="Twig"
         point="org.eclipse.core.resources.natures">
      <runtime>
         <run class="com.dubture.twig.core.TwigNature"></run>
      </runtime>
      <content-type
            id="com.dubture.twig.core.twigtemplate">
      </content-type>
   </extension>
  
   <extension point="org.eclipse.dltk.core.language">
      <language
            class="com.dubture.twig.core.TwigLanguageToolkit"
            nature="com.dubture.twig.core.TwigNature"
            priority="10">
      </language>
   </extension>
  

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev

 


_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev




--
phone +43 676 64 57 240

Zieglergasse 65/6
1070 Vienna
Austria

follow me:
http://twitter.com/pulse00
https://github.com/pulse00


_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev




--
phone +43 676 64 57 240

Zieglergasse 65/6
1070 Vienna
Austria

follow me:
http://twitter.com/pulse00
https://github.com/pulse00


Back to the top