2

Java オブジェクト メソッドのオートコンプリートに役立つ clojure IDE はありますか?

例えば:

(def my-temp-file (java.io.File/createTempFile "filename" ".txt"))

次に、入力したい:

(.deleteOnExit my-temp-file)

どうやって :

(. my-temp-file delet|"ここにカーソル") ;; 自動コンパイルの del* メソッドを取得するにはどうすればよいですか

また

(.delet|"ここにカーソル" my-temp-file) ;; 自動コンパイルの del* メソッドを取得するにはどうすればよいですか

...

今、intellij14.1.4 + cursive0.1.60 を試してみましたが、素晴らしいです。

「delete」から「deleteOnExist」に自動コンパイルしようとしました

状況 1 、これで問題ありません: 状況 1 、これで問題ありません:

状況 2、これは機能しません: 状況 2、これは機能しません:

状況 2 で「deleteOnExist」オートコンプリートを取得するにはどうすればよいですか? 助けてください

4

3 に答える 3

7

IntelliJ プラグインであるCursive Clojureには、これを実行できる優れた Java 相互運用機能があります。

于 2015-09-06T01:20:05.777 に答える
3

The problem with your example is that def does not automatically add the :tag metadata based on the type of its initialiser. You can see this as follows:

Connecting to local IDE...
Clojure 1.7.0
(import java.io.File)
=> java.io.File
(def temp-file (File/createTempFile "filename" ".txt"))
=> #'user/temp-file
temp-file
=> #object[java.io.File 0x6c8b97fd "/var/folders/x1/9k18lcbn4qnfs4pptm0dm8fm0000gn/T/filename8344242261832815384.txt"]
(meta #'temp-file)
=> {:line 1, :column 1, :file "NO_SOURCE_PATH", :name temp-file, :ns #object[clojure.lang.Namespace 0x548b68c5 "user"]}

So your example will work in cases like the following:

(let [temp-file (File/createTempFile "filename" ".txt")]
  (temp-file .dele|))

Where | represents the caret. It will also work if you manually add the tag to your def, like:

(def ^File temp-file (File/createTempFile "filename" ".txt"))
于 2015-09-07T18:38:41.590 に答える
1

タグ emacs を入れたので、 で試すことができciderますac-cider。ただし、オートコンプリートの精度に関しては、このコンボは少しエラーが発生しやすいことがわかりました。推奨されるオプションは、他のクラスのメソッドである場合があります。

于 2015-09-06T08:25:53.337 に答える