40

HamlSassを編集するための構文の強調表示やその他の優れた機能を追加するEclipse用のプラグインはありますか?グーグル検索はlucky-dip.netの死んだプロジェクトを指しているように見えるだけです。

注:私が最も興味を持っているのはSassです。EclipseでSass(またはそれに似たもの)だけを使用するためのソリューションは私のニーズに合っています。

また、Eclipse用のApp Engineプラグインを使用して、Google App Engine(Java)用に開発しています。したがって、別のIDEに切り替えることはできません。


更新:Pascalの回答を使用して構文を強調表示し、 RubyCompassをインストールしてsassをcssにコンパイルしました。

ただし、sassの構文は2.4で変更されることを認識しているので、Aptanaに付属しているHamlおよびSassエディターを機能させたいと思います。私がそれらを使おうとすると、彼らは例外をスローし、ファイルを表示しませんでした。それがAptanaの設定を間違えたためなのか、それともエディターの実際のバグなのかを知りたいと思います。

また、Ecpliseと統合されたSassをコンパイルして、それとは別に何かを実行する必要がないようにする方法にも非常に興味があります。(またはSass / CompassをEcpliseビルドプロセスに配置する方法。)

4

6 に答える 6

28

さて、Aptanaはどうですか?Aptana/Eclipseブログ投稿のHaml/Saas構文ハイライトによると:

最近、私はいくつかのRailsプロジェクトでHamlを使用しています。それは単にあなたの見解をきれいで読みやすくします。私が抱えていた問題の1つは、お気に入りのIDEである AptanaStudioでの構文の強調表示でした。Haml構文の強調表示のサポートはしばらく前に停止されており、Aptanaの最近の更新後にさらに多くの問題が発生しています。

調査の結果、HamlGoogleグループのメンバーであるMaxKostovetskiによって投稿された解決策を見つけました。さて、手順に:

  1. 次のファイルをハードドライブにダウンロードします。>
  2. Aptana Eclipseの[ウィンドウ]メニューから、[設定...]を選択します。
  3. 環境設定ウィンドウで、[編集者]>[一般的なテキスト]を選択します
  4. 「追加...」を押して、新しいファイル拡張子を追加します*.haml*.sass
  5. 新しい拡張機能ごとに、それをクリックし、[参照...]を押して適切なレクサーファイルを選択します(*.lxr
  6. カラー化するには、「インポート...」を押して*.colファイルをインポートします
  7. 「OK」を押します
  8. Hamlビューをお楽しみください

PS:最新のリンクが提供されているので、元のブログ投稿を参照してください。

注:これは、 AptanaRadRailsEclipseプラグインおよびAptanaStudioで使用できます。

更新:執筆時点では、RadRailsとStudioはHamlとSassをサポートしているようです。そのため、上記の手順を実行する必要がなくなる可能性があります。


Eclipse内で「統合された」方法でSaaSをコンパイルするには、外部ツールを使用することができます([実行]> [外部ツール])。もう1つのより複雑なオプションは、このブログ投稿のように、プロジェクトのビルダーに「プログラムビルダー」を追加することです。もちろん、説明されているソリューションはSaasに適合させる必要がありますが、その背後にある原則が当てはまるようです。注意:私はそれを自分で実装しませんでした。それは単なるアイデアであり、それが意味をなすかどうかさえわかりません。

于 2009-10-02T14:41:34.620 に答える
11

最新のEclipseColorerは実際にはHAMLとSASSの両方をサポートしていることに注意してください。フル機能のAptanaIDEが必要ではなく、エディターを探しているだけの場合は、これは良い代替選択肢になる可能性があります。

EclipseColorerは、より優れた構文ミックスインのサポートも提供します。HAML内の他の言語は、構文に関して強調表示されます(ruby、javascript、css、さらにはsassのミックスイン)。

于 2010-05-27T04:55:33.100 に答える
1

HAMLまたはSASS構文ハイライトはまだないようですが、いくつかの利用可能なプラグインを介してEclipseにVIM(HAML構文ハイライトをサポートしている)を導入することに沿って何かを行うことを検討することをお勧めします。 Eclimは可能性があるかもしれません(ただし、私はそれを使用していません-他の選択肢を提供しようとしているだけです)。

もう1つのオプションは、既存のEclipse構文強調表示プラグインを使用して、SassやHAMLの構文強調表示を追加することです。EclipseColorerのようなものは調べる価値があるかもしれません。

于 2009-10-02T16:16:30.977 に答える
1

これは古い質問ですが、私のようなSASSとCompassを初めて使用する人は、Aptana Studio 3をインストールしたところ、.scss、.sass、.hamlがサポートされるようになりました。楽しみ。

于 2012-05-22T19:43:18.033 に答える
1

Igorの回答にあるColorerプラグインは興味深いものでしたが、.scssファイル拡張子を使用しており、.sassファイルに対してのみ機能します。.scssファイル拡張子をサポートする方法は次のとおりです。

まず、通常どおりプラグインをインストールします。Eclipseの[ヘルプ]メニューで選択Install New softwareし、次のリポジトリを追加しますhttp://colorer.sf.net/eclipsecolorer。このリポジトリを選択すると、EclipseColorerのインストールオプションが表示されます。ドラッグインストールオプションAFAIKはありません。

インストール後、Eclipseのプラグインディレクトリ内のColorerプラグインフォルダに移動します。私の場合、それはeclipse/plugins/net.sf.colorer_0.9.9/です。そこで、3つのファイルを変更する必要があります。

  • colorer / hrc / common.jar
  • colorer / hrc / proto.hrc
  • /plugin.xml

以下の手順を実行する前に、問題が発生した場合に復元するために、フォルダ内のすべてのファイルをバックアップしてください。

common.jarの変更

common.jarを空のフォルダーに抽出します。これは、通常のtar.gzファイルと同じように行われます。抽出したら、その中の2つのファイルを変更する必要があります。

の53行目と53行目を複製inet/haml.hrcし、scssに変更します。結果は次のようになります。

<block start='/^((\s\s)*):(sass)/' end='/^\M (\s*$|\y1\s)?! /ix' region='def:Insertion' region01='def:Outlined'
    region00='def:PairStart' region10='def:PairEnd' content-priority='low' scheme='sass:sass'/>
<block start='/^((\s\s)*):(scss)/' end='/^\M (\s*$|\y1\s)?! /ix' region='def:Insertion' region01='def:Outlined'
    region00='def:PairStart' region10='def:PairEnd' content-priority='low' scheme='scss:scss'/>

次に、関連する行をコピーinet/sass.hrcinet/scss.hrcて変更します。結果scss.hrcは次のようになります。

<?xml version="1.0" encoding='Windows-1251'?>
<!DOCTYPE hrc PUBLIC "-//Cail Lomecb//DTD Colorer HRC take5//EN"
  "http://colorer.sf.net/2003/hrc.dtd">
<hrc version="take5" xmlns="http://colorer.sf.net/2003/hrc"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://colorer.sf.net/2003/hrc http://colorer.sf.net/2003/hrc.xsd">

  <type name="scss">

    <annotation>
     <documentation>
      SCSS Sassy CSS 
     </documentation>
     <contributors><![CDATA[
     Igor Russkih irusskih at gmail dot com
     ]]></contributors>
    </annotation>

    <region name="ClassSelector" parent="def:TypeKeyword"/>
    <region name="IDSelector" parent="def:Keyword"/>
    <region name="IncludeMixin" parent="def:Label"/>

    <scheme name='PropertyNames'>
      <regexp match="/(\$)([\w\d\-]+)/" region='def:Var'/>
      <inherit scheme='css:PropertyNames'/>
    </scheme>

    <scheme name="PropertyWrapper">
       <block start="/~/" end="/(:|\s|$)/" scheme="PropertyNames" region10="def:Symbol"/>

       <regexp match="/(\$)([\w\d\-]+)/" region='def:Var'/>

       <inherit scheme="css:Property"/>
    </scheme>

    <scheme name="scss">
       <!-- property value after colon -->
       <block start="/\M([\$\w\d\-]+)\s*(:)/" end="/\M([\x22\x27]|$)/"
              scheme="PropertyWrapper" region02="def:Symbol"
       />
       <block start="/(:)\s*\M([\w\d\-]+)?/" end="/\M([\x22\x27]|$)/"
              scheme="PropertyWrapper" region02="def:Symbol"
       />
       <regexp match="/^ \s* \M[\.\#\=\@\!] (?{def:Outlined}[\w\d\-]+ ) /x" />

       <regexp match="/ \. (?{ClassSelector}[\w\d\-]+ ) /x" />
       <regexp match="/ \# (?{IDSelector}[\w\d\-]+ ) /x" />
       <regexp match="/ [\=\+] (?{IncludeMixin}[\w\d\-]+ ) /x" />

       <regexp match="/[\(\)&apos;&quot;]/" region='def:Symbol'/>

       <regexp match="/\/\/.*$/" region='def:Comment'/>

       <regexp match="/\@(import|extend|mixin)/" region='def:Keyword'/>

    </scheme>

  </type>
</hrc>
<!-- ***** BEGIN LICENSE BLOCK *****
   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
   -
   - The contents of this file are subject to the Mozilla Public License Version
   - 1.1 (the "License"); you may not use this file except in compliance with
   - the License. You may obtain a copy of the License at
   - http://www.mozilla.org/MPL/
   -
   - Software distributed under the License is distributed on an "AS IS" basis,
   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
   - for the specific language governing rights and limitations under the
   - License.
   -
   - The Original Code is the Colorer Library.
   -
   - The Initial Developer of the Original Code is
   - Igor Russkih <irusskih at gmail dot com>
   - Portions created by the Initial Developer are Copyright (C) 2010
   - the Initial Developer. All Rights Reserved.
   -
   - Contributor(s): 
   -
   - Alternatively, the contents of this file may be used under the terms of
   - either the GNU General Public License Version 2 or later (the "GPL"), or
   - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
   - in which case the provisions of the GPL or the LGPL are applicable instead
   - of those above. If you wish to allow use of your version of this file only
   - under the terms of either the GPL or the LGPL, and not to allow others to
   - use your version of this file under the terms of the MPL, indicate your
   - decision by deleting the provisions above and replace them with the notice
   - and other provisions required by the LGPL or the GPL. If you do not delete
   - the provisions above, a recipient may use your version of this file under
   - the terms of any one of the MPL, the GPL or the LGPL.
   -
   - ***** END LICENSE BLOCK ***** -->

この後、common.jarを抽出したフォルダーで次のコマンドを実行して、jarファイルを再作成します。

jar cf common.jar *

次に、元のjarファイルをこれに置き換えます。

その他のファイル

/plugin.xmlここで、 37行目にscss拡張機能を含めます。

extends = "xml、xsd、xsl、dtd、hrc、hrd、html、htm、xhtml、rhtml、erb、yml、haml、sass、scss、css、asp、aspx、jsp、fo、svg、dbk、docbook、jhtml 、jspf、php、php3、php4、phtml、sgm、sgml、shtm、shtml "

そして最後に、の行200〜203を複製しcolorer/hrc/proto.hrcます。結果は次のようになります。

<prototype name="sass" group="inet" description="SASS">
  <location link="jar:common.jar!inet/sass.hrc"/>
  <filename>/\.(sass)$/i</filename>
</prototype>
<prototype name="scss" group="inet" description="SCSS">
  <location link="jar:common.jar!inet/scss.hrc"/>
  <filename>/\.(scss)$/i</filename>
</prototype>

この後、Eclipseを再起動すると、.scssファイルの構文が強調表示されます。

于 2016-06-02T17:44:58.220 に答える
1

Aptanaは私にとって非常に多くの問題を引き起こすので、(このスレッドを見つけた)多くの検索の後、LiClipseText(https://marketplace.eclipse.org/content/liclipsetext)を見つけました。

これは、とりわけ、SASS/SCSSファイルの構文の強調表示を提供するプラグインです。それは機能しているようで、「構文の強調表示(LiClipse、TextMate、またはSublimeTextベース)」を備えているので、おそらくかなり構成可能です(私はあまり遊んでいませんが、基本的な構文の強調表示機能は私のために機能しています。 Eclipse WST CSSエディターはSCSSファイルに対して実行できます)。

これは、私が使用していない商用LiClipseプラグイン(https://marketplace.eclipse.org/content/liclipse)のオープンソースのエディターコンポーネントです。

于 2016-06-14T11:09:05.600 に答える