]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/plugins/scala/_scala
initial
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / plugins / scala / _scala
1 #compdef scala scalac
2 # ------------------------------------------------------------------------------
3 # Copyright (c) 2012 Github zsh-users - https://github.com/zsh-users
4 # All rights reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are met:
8 #     * Redistributions of source code must retain the above copyright
9 #       notice, this list of conditions and the following disclaimer.
10 #     * Redistributions in binary form must reproduce the above copyright
11 #       notice, this list of conditions and the following disclaimer in the
12 #       documentation and/or other materials provided with the distribution.
13 #     * Neither the name of the zsh-users nor the
14 #       names of its contributors may be used to endorse or promote products
15 #       derived from this software without specific prior written permission.
16 #
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 # DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
21 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 # ------------------------------------------------------------------------------
28 # Description
29 # -----------
30 #
31 #  Completion script for scala and scalac (https://www.scala-lang.org/).
32 #
33 # ------------------------------------------------------------------------------
34 # Authors
35 # -------
36 #
37 #  * Tony Sloane <inkytonik@gmail.com>
38 #
39 # ------------------------------------------------------------------------------
40
41 typeset -A opt_args
42 local context state line
43
44 _scala_features () {
45    compadd "postfixOps" "reflectiveCalls" "implicitConversions" "higherKinds" \
46      "existentials" "experimental.macros" "_"
47 }
48
49 _scala_phases () {
50    compadd "parser" "namer" "packageobjects" "typer" "patmat" "superaccessors" \
51      "extmethods" "pickler" "refchecks" "selectiveanf" "selectivecps" "uncurry" \
52      "tailcalls" "specialize" "explicitouter" "erasure" "posterasure" "lazyvals" \
53      "lambdalift" "constructors" "flatten" "mixin" "cleanup" "icode" "inliner" \
54      "inlineExceptionHandlers" "closelim" "dce" "jvm" "terminal"
55 }
56
57 local -a shared_opts
58 shared_opts=(
59   "-bootclasspath+[Override location of bootstrap class files]:bootstrap class directory:_files -/"
60   "-classpath+[Specify where to find user class files]:directory:_files -/"
61   "-D-[Pass -Dproperty=value directly to the runtime system]"
62   "-d+[Destination for generated classfiles]: directory or jar file:_files"
63   "-dependencyfile+[Set dependency tracking file]:dependency tracking file:_files"
64   "-deprecation[Emit warning and location for usages of deprecated APIs]"
65   "-encoding+[Specify character encoding used by source files]:encoding:"
66   "-explaintypes[Explain type errors in more detail]"
67   "-extdirs+[Override location of installed extensions]:extensions directory:_files -/"
68   "-g\:-[Set level of generated debugging info (default\: vars)]:debugging info level:(none source line vars notailcalls)"
69   "-help[Print a synopsis of standard options]"
70   "-J-[pass argument directly to Java runtime system]:JVM argument:"
71   "-javabootclasspath+[Override java boot classpath]:Java boot class path directory]:_files -/"
72   "-javaextdirs+[Override java extdirs classpath]:Java extdirs directory:_files -/"
73   "-language\:-[Enable one or more language features]:feature:_scala_features"
74   "-no-specialization[Ignore @specialize annotations]"
75   "-nobootcp[Do not use the boot classpath for the scala jars]"
76   "-nowarn[Generate no warnings]"
77   "-optimise[Generate faster bytecode by applying optimisations to the program]"
78   "-P\:-[Pass an option to a plugin (written plugin\:opt)]:plugin option:"
79   "-print[Print program with Scala-specific features removed]"
80   "-sourcepath+[Specify location(s) of source files]:source file directory:_files -/"
81   "-target\:-[Target platform for object files (default\: jvm-1.5)]:platform name:(jvm-1.5 msil)"
82   "-toolcp+[Add to the runner classpath]:directory:_files -/"
83   "-unchecked[Enable detailed unchecked (erasure) warnings]"
84   "-uniqid[Uniquely tag all identifiers in debugging output]"
85   "-usejavacp[Utilize the java.class.path in classpath resolution]"
86   "-verbose[Output messages about what the compiler is doing]"
87   "-version[Print product version and exit]"
88   "-X[Print a synopsis of advanced options]"
89   "-Y[Print a synopsis of private options]"
90 )
91
92 local -a X_opts
93 X_opts=(
94   "-Xcheck-null[Warn upon selection of nullable reference]"
95   "-Xcheckinit[Wrap field accessors to throw an exception on uninitialized access]"
96   "-Xdisable-assertions[Generate no assertions or assumptions]"
97   "-Xelide-below+[Calls to @elidable methods are omitted if method priority is lower than integer argument]"
98   "-Xexperimental[Enable experimental extensions]"
99   "-Xfatal-warnings[Fail the compilation if there are any warnings]"
100   "-Xfull-lubs[Retains pre 2.10 behavior of less aggressive truncation of least upper bounds]"
101   "-Xfuture[Turn on future language features]"
102   "-Xgenerate-phase-graph+[Generate the phase graphs (outputs .dot files) to fileX.dot]:output file:_files"
103   "-Xlint[Enable recommended additional warnings]"
104   "-Xlog-free-terms[Print a message when reification creates a free term]"
105   "-Xlog-free-types[Print a message when reification resorts to generating a free type]"
106   "-Xlog-implicits[Show more detail on why some implicits are not applicable]"
107   "-Xlog-implicit-conversions[Print a message whenever an implicit conversion is inserted]"
108   "-Xlog-reflective-calls[Print a message when a reflective method call is generated]"
109   "-Xmacro-settings\:-[Custom settings for macros]:option"
110   "-Xmain-class+[Class for manifest's Main-Class entry (only useful with -d jar)]:path:"
111   "-Xmax-classfile-name+[Maximum filename length for generated classes]"
112   "-Xmigration[Warn about constructs whose behavior may have changed]"
113   "-Xno-forwarders[Do not generate static forwarders in mirror classes]"
114   "-Xno-patmat-analysis[Don't perform exhaustivity/unreachability analysis. Also, ignore @switch annotation]"
115   "-Xno-uescape[Disable handling of \u unicode escapes]"
116   "-Xnojline[Do not use JLine for editing]"
117   "-Xoldpatmat[Use the pre-2.10 pattern matcher. Otherwise, the 'virtualizing' pattern matcher is used in 2.10]"
118   "-Xprint\:-[Print out program after <phase>]:phase name:_scala_phases"
119   "-Xprint-icode\:-[Log internal icode to *.icode files after phase (default\: icode)]:phase name:_scala_phases"
120   "-Xprint-pos[Print tree positions, as offsets]"
121   "-Xprint-types[Print tree types (debugging option)]"
122   "-Xprompt[Display a prompt after each error (debugging option)]"
123   "-Xresident[Compiler stays resident: read source filenames from standard input]"
124   "-Xscript+[Treat the source file as a script and wrap it in a main method]:main object name"
125   "-Xshow-class+[Show internal representation of class]:class name"
126   "-Xshow-object+[Show internal representation of object]:object name"
127   "-Xshow-phases[Print a synopsis of compiler phases]"
128   "-Xsource-reader+[Specify a class name for a custom method of reading source files]:class name"
129   "-Xverify[Verify generic signatures in generated bytecode]"
130
131   "-Xassem-extdirs+[List of directories containing assemblies (requires -target:msil) (default\: lib)]:assembly directory:_files -/"
132   "-Xassem-name+[Name of the output assembly (requires -target:msil)]:assembly name:_files"
133   "-Xassem-path+[List of assemblies referenced by the program (requires -target:msil)]:assembly path:_files"
134   "-Xsourcedir+[Mirror source folder structure in output directory (requires -target:msil)]:source directory:_files -/"
135
136   "-Xplugin\:-[Load one or more plugins from file]:plugin file:_files"
137   "-Xpluginsdir+[Path to search compiler plugins]:plugin directory:_files -/"
138   "-Xplugin-list[Print a synopsis of loaded plugins]"
139   "-Xplugin-disable\:-[Disable the given plugin(s)]"
140   "-Xplugin-require\:-[Abort unless the given plugin(s) are available]"
141 )
142
143 local -a Y_opts
144 Y_opts=(
145   "-Y[Print a synopsis of private options]"
146   "-Ybuild-manager-debug[Generate debug information for the Refined Build Manager compiler]"
147   "-Ybuilder-debug\:-[Compile using the specified build manager (default\: none)]:build manager:(none refined simple)"
148   "-Yclosure-elim[Perform closure elimination]"
149   "-Ycompact-trees[Use compact tree printer when displaying trees]"
150   "-Ydead-code[Perform dead code elimination]"
151   "-Ydependent-method-types[Allow dependent method types]"
152   "-Ydump-classes+[Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders)]:output directory:_files -/"
153   "-Yeta-expand-keeps-star[Eta-expand varargs methods to T* rather than Seq[T].  This is a temporary option to ease transition.]"
154   "-Ygen-javap+[Generate a parallel output directory of .javap files]:output directory:_files -/"
155   "-Yinfer-argument-types[Infer types for arguments of overridden methods]"
156   "-Yinline[Perform inlining when possible]"
157   "-Yinline-handlers[Perform exception handler inlining when possible]"
158   "-Yinline-warnings[Emit inlining warnings (normally suppressed due to high volume)]"
159   "-Yinvalidate+[Invalidate classpath entry before run]:classpath entry"
160   "-Ylinearizer\:-[Linearizer to use (default\: rpo)]:linearizer:(normal dfs rpo dump)"
161   "-Ylog-classpath[Output information about what classpath is being applied]"
162   "-Yno-adapted-args[Do not adapt an argument list (either by inserting unit or creating a tuple) to match the receiver]"
163   "-Ymacro-debug-lite[Trace essential macro-related activities]"
164   "-Ymacro-debug-verbose[Trace all macro-related activities: compilation, generation of synthetics, classloading, expansion, exceptions]"
165   "-Yno-completion[Disable tab-completion in the REPL]"
166   "-Yno-generic-signatures[Suppress generation of generic signatures for Java]"
167   "-Yno-imports[Compile without any implicit imports]"
168   "-Yno-predef[Compile without importing Predef]"
169   "-Yno-self-type-checks[Suppress check for self-type conformance among inherited members]"
170   "-Yno-squeeze[Disable creation of compact code in matching]"
171   "-Ynotnull[Enable (experimental and incomplete) scala.NotNull]"
172   "-Yoverride-objects[Allow member objects to be overridden]"
173   "-Yoverride-vars[Allow vars to be overridden]"
174   "-Ypmat-naive[Desugar matches as naively as possible]"
175   "-Ypresentation-delay+[Wait number of ms after typing before starting typechecking]"
176   "-Ypresentation-log+[Log presentation compiler events into file]:log file:_files"
177   "-Ypresentation-replay+[Replay presentation compiler events from file]:log file:_files"
178   "-Ypresentation-strict[Do not report type errors in sources with syntax errors]"
179   "-Ypresentation-verbose[Print information about presentation compiler tasks]"
180   "-Yprofile-class+[Specify name of profiler class]:profiler class name"
181   "-Yprofile-memory[Heap snapshot after compiler run (requires jgpagent on JVM -agentpath)]"
182   "-Yrangepos[Use range positions for syntax trees]"
183   "-Yrecursion+[Set recursion depth used when locking symbols]"
184   "-Yreify-copypaste[Dump the reified trees in copypasteable representation]"
185   "-Yrepl-sync[Do not use asynchronous code for REPL startup]"
186   "-Yresolve-term-conflict\:-[Resolve term conflicts (default\: error)]:resolution strategy:(package object error)"
187   "-Yself-in-annots[Include a \"self\" identifier inside of annotations]"
188   "-Yshow\:-[Show after <phase> (requires -Xshow-class or -Xshow-object)]:phase name:_scala_phases"
189   "-Yshow-syms[Print the AST symbol hierarchy after each phase]"
190   "-Yshow-symkinds[Print abbreviated symbol kinds next to symbol names]"
191   "-Yshow-trees[Print detailed ASTs (requires -Xprint\:phase)]"
192   "-Yshow-trees-compact[Print detailed ASTs in compact form (requires -Xprint\:)]"
193   "-Yshow-trees-stringified[Print stringification along with detailed ASTs (requires -Xprint\:)]"
194   "-Ystatistics[Print compiler statistics]"
195   "-Ystruct-dispatch\:-[Structural method dispatch policy (default\: poly-cache)]:policy name:(no-cache mono-cache poly-cache invoke-dynamic)"
196
197   "-Ybrowse\:-[Browse the abstract syntax tree after <phase>]:phase name:_scala_phases"
198   "-Ycheck\:-[Check the tree at the end of <phase>]:phase name:_scala_phases"
199   "-Ylog\:-[Log operations during <phase>]:phase name:_scala_phases"
200   "-Yprofile\:-[Profile CPU usage of given phases (requires jgpagent on JVM -agentpath)]:phase name:_scala_phases"
201   "-Yskip\:-[Skip <phase>]:phase name:_scala_phases"
202   "-Ystop-after\:-[Stop after given phase <phase>]:phase name:_scala_phases"
203   "-Ystop-before\:-[Stop before given phase <phase>]:phase name:_scala_phases"
204
205   "-Ywarn-adapted-args[Warn if an argument list is modified to match the receiver]"
206   "-Ywarn-all[Enable all -Y warnings]"
207   "-Ywarn-dead-code[Warn when dead code is identified]"
208   "-Ywarn-inaccessible[Warn about inaccessible types in method signatures]"
209   "-Ywarn-nullary-override[Warn when non-nullary overrides nullary, e.g. def foo() over def foo]"
210   "-Ywarn-nullary-unit[Warn when nullary methods return Unit]"
211   "-Ywarn-numeric-widen[Warn when numerics are widened]"
212   "-Ywarn-value-discard[Warn when non-Unit expression results are unused]"
213
214   "-Ybuild-manager-debug[Generate debug information for the Refined Build Manager compiler]"
215   "-Ybuilder-debug\:-[Compile using the specified build manager (default\: none)]:manager:(none refined simple)"
216   "-Ycompletion-debug[Trace all tab completion activity]"
217   "-Ydebug[Increase the quantity of debugging output]"
218   "-Ydoc-debug[Trace all scaladoc activity]"
219   "-Yide-debug[Generate, validate and output trees using the interactive compiler]"
220   "-Yinfer-debug[Trace type inference and implicit search]"
221   "-Yissue-debug[Print stack traces when a context issues an error]"
222   "-Ypatmat-debug[Trace pattern matching translation]"
223   "-Ypmat-debug[Trace all pattern matcher activity]"
224   "-Ypos-debug[Trace position validation]"
225   "-Ypresentation-debug[Enable debugging output for the presentation compiler]"
226   "-Yreify-debug[Trace reification]"
227   "-Yrepl-debug[Trace all REPL activity]"
228   "-Ytyper-debug[Trace all type assignments]"
229 )
230
231 local -a scala_opts
232 scala_opts=(
233   "-e+[execute <string> as if entered in the repl]:string" \
234   "-howtorun+[what to run (default\: guess)]:execution mode:(script object jar guess)" \
235   "-i+[preload <file> before starting the repl]:file to preload:_files" \
236   "-nc[no compilation daemon\: do not use the fsc offline compiler]" \
237   "-save[save the compiled script in a jar for future use]"
238 )
239
240 case $words[$CURRENT] in
241     -X*) _arguments $X_opts;;
242     -Y*) _arguments $Y_opts;;
243       *) case $service in
244            scala)  _arguments $scala_opts $shared_opts "*::filename:_files";;
245            scalac) _arguments $shared_opts "*::filename:_files";;
246          esac
247 esac
248
249 return 0