MCPcopy Index your code
hub / github.com/dcaoyuan/nbscala

github.com/dcaoyuan/nbscala @v1.7.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.7.0.0 ↗ · + Follow
6,401 symbols 24,023 edges 378 files 3,463 documented · 54%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

NetBeans Plugin for Scala

Index

  1. Common Informations
  2. Where to start?
  3. Community
  4. Snapshot Builds
  5. Build Instructions
  6. Project Details

Common Informations

This is a plugin of the Netbeans Platform for the scala language. In the case of a maven scala project, no local installation of scala is needed. It enables syntax checking, syntax highlighting, auto-completion, pretty formatter, occurrences mark, brace matching, indentation, code folding, function navigator, go to declaration, project management and a shell console. It's is specially useful if you are a maven user.

Notice

The Ant based project will be removed soon, which, by far, is not under improving any more. Please use sbt/maven based project.

Where to start ?

The project central point is https://github.com/dcaoyuan/nbscala. There are some other places, where the project was hosted before, but they are abandoned now.

Community

Until recently, this has mostly been a one man project. Some patches were supplied by different people, but I'm still convinced that it will gather a community soon. For questions and bug reports use the issue tracker. If interested in joining the project, you can write me directly or send patches/pull requests.

Where to download

Released builds can be found here https://sourceforge.net/projects/erlybird/files/nb-scala/. Choose proper folder which begins with NetBeans version number then followed supported Scala version. If I have time, the plugins will also be uploaded to http://plugins.netbeans.org, and may be avaliable via the NetBeans Update Center automatically when it passed verification by NetBeans staffs.

Installation

Make sure you don't have an old version installed. (Check your netbeans installation for a 'nbscala' directory: if it exists, delete it.)

  1. Download the latest release at plugins.netbeans.org.
  2. Extract all files into a directory.
  3. Start Netbeans.
  4. Select Tools -> Plugins -> Downloaded -> Add Plugins...
  5. Select all extracted files.
  6. Accept the license and the installation of unsigned plugins.

Build Instructions

Cause of the small group of people involved in the project we only supply updates for the latest netbeans version.

Requirement - Run:

  • Java 1.6+
  • NetBeans 7.4+

Requirement - Build:

  • Java 1.7 (for master branch)
  • Java 1.6 (for 2.9.x branch)
  • Maven 2.x/3.x
  • NetBeans 7.4+

Branches:

  • master -- tracking Scala 2.10.x and 2.11.x currently
  • 2.9.x -- for Scala 2.9.x

Setting nb.installation property for maven

Hint: This is going to be removed in the future. There is already a nbm-application based subproject which can be used to run all modules of the plugin. See the scala.app/pom.xml for more information, what is still missing.

Make a new copy of your installed NetBeans (which will be used to run 'mvn nbm:run-ide' goal), check if there is a directory 'nbscala' under this copy, if yes, delete it. Then set 'nb.installation' property in your maven settings.xml (.m2/settings.xml) to point to this copy:

<profiles>
    <profile>
        <id>netbeans</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <nb.installation>${user.home}/myapps/netbeans-8.0-fordev</nb.installation>
        </properties>
    </profile>
</profiles>

Set system environment variable for building.

MAVEN_OPTS=-Xss8M

or even more:

MAVEN_OPTS=-Xss8M -Xmx1024M

Build all nbms

cd nbscala
mvn clean install

Generate auto-update site:

cd nbscala
mvn nbm:autoupdate

the nbms and update site can be found at nbscala/target/netbeans_site

Run/Debug ide:

cd nbscala
mvn nbm:cluster

To run:

mvn nbm:run-ide

To debug:

mvn nbm:run-ide -Pdebug-ide

Build-Run-Cycle: (after changed module was successfuly built)

mvn nbm:cluster nbm:run-ide

Build-Debug-Cycle: (after changed module was successfuly built)

mvn nbm:cluster nbm:run-ide -Pdebug-ide

Publish to plugins.netbeans.org

Generate keys/keystore (note: The keystore and key password needs to be the same):

keytool -genkey -dname "CN=Caoyuan Deng, OU=nbscala, O=inloop.io, L=Richmond, S=BC, C=CA" -alias nbscala -validity 1800
keytool -list -v

Enable signing modules by adding all three keystore related parameters in ~/m2/settings.xml as:

             <profiles>
                 <profile>
                     <id>sign-nbscala-nbms</id>
                     <activation>
                         <activeByDefault>true</activeByDefault>
                     </activation>
                     <properties>
                         <nbm.sign.keystore>${user.home}/.keystore</nbm.sign.keystore>
                         <nbm.sign.keystorealias>nbscala</nbm.sign.keystorealias>
                         <nbm.sign.keystorepassword>thepassword</nbm.sign.keystorepassword>
                     </properties>
                 </profile>
             </profiles>

Pack a zip file for plugins.netbeans.org:

mvn nbm:autoupdate
cd target/netbeans_site
zip nbscala-version.zip *.nbm

Installation Notes:

  • After installation, it's always better to restart NetBeans
  • You may need to delete NetBeans' old cache to get improved features working. To find the cache location, read the netbeans.conf at:
    $NetBeansInstallationPlace/etc/netbeans.conf
    

Project Details

The Project targets version 2.10.x and 2.11.x of the scala release.

Scala Console Integration

A new Scala shell console was implemented recently (since Feb 27, 2013)

To open it, right click on project, and choose "Open Scala Console"

Features:

  • Be aware of project's classpath that could be imported, new, run under console
  • Popup auto-completion when press \<tab>
  • Applied also to Java SE projects and Maven projects

Sbt Integration

Only Scala-2.10+ is supported under NetBeans

  • That is, always try to set your project's Scala version to 2.10+ in Build.scala or build.sbt:
    scalaVersion := "2.10.0"
    

Supported features

  • Recognize sbt project and open in NetBeans
  • Open sbt console in NetBeans (Right click on sbt project, choose "Open Sbt")
  • Jump to/Open compile error lines

How to

  • Install the newest nbscala plugins, download directly or build by yourself on NetBeans 7.4+.
  • Git clone, build and publish-local a NetBeans special sbt plugin https://github.com/dcaoyuan/nbsbt (nbsbt-plugin 1.1.2+ has been deployed to repo.scala-sbt.org, that means it will be automatilly resolved when you run sbt):

    git clone git@github.com:dcaoyuan/nbsbt.git
    cd nbsbt
    sbt clean compile publish-local
    
  • Add nbsbt to your plugin definition file. You can use either the global one at ~/.sbt/0.13/plugins/plugins.sbt or the project-specific one at PROJECT_DIR/project/plugins.sbt

    addSbtPlugin("org.netbeans.nbsbt" % "nbsbt-plugin" % "1.1.4")
    

FAQ

Q: NetBeans' response becomes slower after a while.

A: Edit your NetBeans configuration file (NetBeansInstallationPlace/etc/netbeans.conf), add -J-Xmx1024M (or bigger)

Q: How to navigate sbt project's dependency sources.

A: From version 1.6.3, this plugin supported to open ivy's sources jar. You may need to have sbt download the dependency's sources, please see http://www.scala-sbt.org/0.13.1/docs/Detailed-Topics/Library-Management.html#download-sources. Hint: run "updateClassifiers"

Q: I got:

[error] sbt.IncompatiblePluginsException: Binary incompatibility in plugins detected.

A: Try to remove published nbsbt plugin from your local .ivy2 repository and sbt plugins cache:

rm -r ~/.ivy2/local/org.netbeans.nbsbt
rm -r ~/.sbt/0.13/plugins/target

and redo 'publish-local' for the NetBeans sbt plugin https://github.com/dcaoyuan/nbsbt.

Q: I got:

[error] Not a valid command: netbeans
[error] Expected '/'
[error] Expected ':'
[error] Not a valid key: netbeans (similar: test, tags, streams)
[error] netbeans
[error]         ^

A: Try to remove the project/target folder under your project base directory, there may be something cached here, and was not reflected to the newest condition.

Q: What will this plugin do upon my project?

A: It will generate a NetBeans project definition file ".classpath_nb" for each project.

Q: It seems there are some suspicious error hints displayed on the edited source file, how can I do?

A: There may be varies causes, you can try open another source file, then switch back to this one, the error hints may have disappeared. If not, right click in editing window, choose 'Reset Scala Parser', and try the steps mentioned previous again.

Q: My project's definition was changed, how to reflect these changes to NetBeans.

A: Right click on the root project, choose "Reload Project".

Q: Exiting from Scala console leaves terminal unusable.

A: Under some unix-like environment, scala interactive console started with some stty setting, but not for NetBeans's integrated one. You can try 'reset' after quit from NetBeans.

Extension points exported contracts — how you extend this code

Action (Interface)
The interface to all actions. An action implements a computation that takes a single argument and produces a single res [39 …
libs.xtc/src/main/java/xtc/util/Action.java
J2SEPropertyEvaluator (Interface)
Readonly access to project properties through PropertyEvaluator, an instance will be in lookup of the j2seproject. @aut [3 …
scala.project/src/main/java/org/netbeans/modules/scala/project/api/J2SEPropertyEvaluator.java
ScalaPlatformProvider (Interface)
(no doc) [3 implementers]
scala.platform/src/main/java/org/netbeans/modules/scala/platform/ScalaPlatformProvider.java
F0 (Interface)
A function with no arguments. [24 implementers]
libs.xtc/src/main/java/xtc/util/Function.java
J2SERunConfigProvider (Interface)
Provider of component that will be added to Run customizer panel that will be used for additional customization of set o
scala.project/src/main/java/org/netbeans/modules/scala/project/api/J2SERunConfigProvider.java
F1 (Interface)
A function with one argument. [24 implementers]
libs.xtc/src/main/java/xtc/util/Function.java
F2 (Interface)
A function with two arguments. [24 implementers]
libs.xtc/src/main/java/xtc/util/Function.java
F3 (Interface)
A function with three arguments. [24 implementers]
libs.xtc/src/main/java/xtc/util/Function.java

Core symbols most depended-on inside this repo

apply
called by 4339
libs.xtc/src/main/java/xtc/util/Function.java
cast
called by 3835
libs.xtc/src/main/java/xtc/typical/Analyzer.java
create
called by 2141
libs.xtc/src/main/java/xtc/tree/GNode.java
hasValue
called by 1999
libs.xtc/src/main/java/xtc/parser/Result.java
p
called by 1676
libs.xtc/src/main/java/xtc/tree/Printer.java
select
called by 1298
libs.xtc/src/main/java/xtc/parser/Result.java
semanticValue
called by 1029
libs.xtc/src/main/java/xtc/parser/Result.java
character
called by 920
libs.xtc/src/main/java/xtc/parser/ParserBase.java

Shape

Method 5,745
Class 601
Interface 35
Enum 18
Function 2

Languages

Java100%
C1%

Modules by API surface

libs.xtc/src/main/java/xtc/typical/TypicalTypes.java372 symbols
scala.core/src/main/java/org/netbeans/modules/scala/core/rats/ParserScala.java358 symbols
libs.xtc/src/main/java/xtc/typical/TypicalSupport.java237 symbols
libs.xtc/src/main/java/xtc/typical/TypicalParser.java197 symbols
libs.xtc/src/main/java/xtc/typical/TreeFactory.java177 symbols
libs.xtc/src/main/java/xtc/typical/Transformer.java132 symbols
scala.core/src/main/java/org/netbeans/modules/scala/core/rats/LexerScala.java122 symbols
libs.xtc/src/main/java/xtc/lang/JavaPrinter.java121 symbols
libs.xtc/src/main/java/xtc/type/Type.java120 symbols
libs.xtc/src/main/java/xtc/parser/PParser.java106 symbols
libs.xtc/src/main/java/xtc/typical/FlagSetter.java88 symbols
libs.xtc/src/main/java/xtc/typical/Tuple.java87 symbols

For agents

$ claude mcp add nbscala \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact