Class JavaScriptLanguageSupport

    • Field Detail

      • xmlAvailable

        private boolean xmlAvailable
      • client

        private boolean client
      • strictMode

        private boolean strictMode
      • languageVersion

        private int languageVersion
      • defaultJshintrc

        private java.io.File defaultJshintrc
      • PROPERTY_LISTENER

        private static final java.lang.String PROPERTY_LISTENER
        Client property installed on text areas that points to a listener.
        See Also:
        Constant Field Values
    • Constructor Detail

      • JavaScriptLanguageSupport

        public JavaScriptLanguageSupport()
    • Method Detail

      • createJarManager

        protected JarManager createJarManager()
        Creates a jar manager instance for used in JS language support.
        Returns:
        The jar manager instance.
      • setECMAVersion

        public void setECMAVersion​(java.lang.String version,
                                   JarManager jarManager)
      • createJavaScriptCompletionProvider

        protected JavaScriptCompletionProvider createJavaScriptCompletionProvider()
        Creates the provider to use for an RSTA instance editing JavaScript. Subclasses can override to return custom subclasses of JavaScriptCompletionProvider.
        Returns:
        The provider.
      • getDefaultJsHintRCFile

        public java.io.File getDefaultJsHintRCFile()
        Returns the location of the .jshintrc file to use if using JsHint as your error parser, and no .jshintrc file is found in the current file's folder hierarchy. This property is ignored if getErrorParser() does not return JsErrorParser.JSHINT.
        Returns:
        The .jshintrc file, or null if none; in that case, the JsHint defaults will be used.
        See Also:
        setErrorParser(JsErrorParser)
      • getErrorParser

        public JsErrorParser getErrorParser()
        Returns the engine to use for checking for syntax errors in JavaScript files. Note that regardless of the value specified to this method, Rhino is always used for code completion and the outline tree.
        Returns:
        The engine.
        See Also:
        setErrorParser(JsErrorParser)
      • getJarManager

        public JarManager getJarManager()
      • getJsHintIndent

        public int getJsHintIndent()
      • getLanguageVersion

        public int getLanguageVersion()
        Sets the JS version to use when parsing the code. This parameter is ignored if the error parser is set to JsErrorParser.RHINO.
        Returns:
        The JS version. This should be one of the VERSION_xxx constants in Rhino's Context class. If this is set to a value unknown to Rhino, then Rhino's default value is used (VERSION_DEFAULT).
        See Also:
        setLanguageVersion(int)
      • getParser

        public JavaScriptParser getParser​(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
        Returns the JS parser running on a text area with this JavaScript language support installed.
        Parameters:
        textArea - The text area.
        Returns:
        The JS parser. This will be null if the text area does not have this JavaScriptLanguageSupport installed.
      • installKeyboardShortcuts

        private void installKeyboardShortcuts​(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
        Installs extra keyboard shortcuts supported by this language support.
        Parameters:
        textArea - The text area to install the shortcuts into.
      • isStrictMode

        public boolean isStrictMode()
        Returns whether strict mode (more warnings are detected) is enabled. This parameter is ignored if the error parser is set to JsErrorParser.RHINO.
        Returns:
        Whether strict mode is enabled.
        See Also:
        setStrictMode(boolean)
      • isXmlAvailable

        public boolean isXmlAvailable()
        Returns whether E4X is supported in parsed JavaScript. This parameter is ignored if the error parser is set to JsErrorParser.RHINO.
        Returns:
        Whether E4X is supported.
        See Also:
        setXmlAvailable(boolean)
      • isClient

        public boolean isClient()
        Returns whether this JavaScript support supports client/browser objects. This parameter is ignored if the error parser is set to JsErrorParser.RHINO.
        Returns:
        Whether the JavaScript support supports client/browser objects.
        See Also:
        setClient(boolean)
      • reparseDocument

        protected void reparseDocument​(int offset)
      • setClient

        public void setClient​(boolean client)
        Set whether the JavaScript support supports client/browser objects. This parameter is ignored if the error parser is set to JsErrorParser.RHINO.
        Parameters:
        client - True if client mode is supported.
        See Also:
        isClient()
      • setDefaultJsHintRCFile

        public boolean setDefaultJsHintRCFile​(java.io.File file)
        Sets the location of the .jshintrc file to use if using JsHint as your error parser, and no .jshintrc file is found in the current file's folder hierarchy. This property is ignored if getErrorParser() does not return JsErrorParser.JSHINT.
        Parameters:
        file - The .jshintrc file, or null if none; in that case, the JsHint defaults will be used.
        Returns:
        Whether the new .jshintrc file is different from the original one.
        See Also:
        getDefaultJsHintRCFile(), setErrorParser(JsErrorParser)
      • setErrorParser

        public boolean setErrorParser​(JsErrorParser errorParser)
        Sets the engine to use for identifying syntax errors in JavaScript files. Note that regardless of the value specified to this method, Rhino is always used for code completion and the outline tree.
        Parameters:
        errorParser - The engine to use. This cannot be null.
        Returns:
        Whether this was actually a new error parser.
        See Also:
        getErrorParser()
      • setLanguageVersion

        public void setLanguageVersion​(int languageVersion)
        Sets the JS version to use when parsing the code. This parameter is ignored if the error parser is set to JsErrorParser.RHINO.
        Parameters:
        languageVersion - The JS version. This should be one of the VERSION_xxx constants in Rhino's Context class. If this is set to a value less than zero, then ES6 is used (VERSION_ES6).
        See Also:
        getLanguageVersion()
      • setStrictMode

        public boolean setStrictMode​(boolean strict)
        Sets whether strict mode (more warnings are detected) is enabled. This parameter is ignored if the error parser is set to JsErrorParser.RHINO.
        Parameters:
        strict - Whether strict mode is enabled.
        Returns:
        Whether a new value was actually set for this property.
        See Also:
        isStrictMode()
      • setXmlAvailable

        public boolean setXmlAvailable​(boolean available)
        Sets whether E4X is supported in parsed JavaScript. This parameter is ignored if the error parser is set to JsErrorParser.RHINO.
        Parameters:
        available - Whether E4X is supported.
        Returns:
        Whether a new value was actually set for this property.
        See Also:
        isXmlAvailable()
      • uninstall

        public void uninstall​(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
        Description copied from interface: LanguageSupport
        Uninstalls this support.
        Parameters:
        textArea - The text area to uninstall from.
        See Also:
        LanguageSupport.install(RSyntaxTextArea)
      • uninstallKeyboardShortcuts

        private void uninstallKeyboardShortcuts​(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
        Uninstalls any keyboard shortcuts specific to this language support.
        Parameters:
        textArea - The text area to uninstall the actions from.