Git Product home page Git Product logo

julia-sublime's Introduction

Julia-sublime

Julia language support for Sublime Text 4 or above

  • Syntax highlighting
  • Unicode tab completion (like the REPL)
  • Auto-indentation
  • Snippets

Installation

If you haven't already, install Package Control, then select Julia from the Package Control: Install Package dropdown list in the Command Palette.

Manual installation

If you want more control over what you pull down, or if you'd like to submit a PR, you coould clone the repository directly.

# on a Mac
cd "$HOME/Library/Application Support/Sublime Text/Packages"
# on Linux
cd $HOME/.config/sublime-text/Packages
# on Windows (PowerShell)
cd "$env:appdata\Sublime Text\Packages\"

git clone [email protected]:JuliaEditorSupport/Julia-sublime.git Julia

Technical details

Sublime Text version support

This package should be only used in Sublime Text 4 or above. Sublime Text 3 support is deprecated. You are still able to install older version (0.9.0) of Julia from Package Control or from GitHub release https://github.com/juliaeditorsupport/julia-sublime/releases.

Custom colors

The default colors are chosen to satisfy most people. However, you might prefer to highlight macros, types, function calls etc. in different colors. This can be achieved by modifying the color associated with the syntax scope, such as variable.macro, in your color scheme. Use the shortcut ctrl+shift+alt+p or cmd+alt+p (macOS) to find out what syntax scope is applied to a certain character.

Contributing

  • Run the build command by hitting ctrl+shift+b or cmd+shift+b(macOS) on the syntax_test_julia.jl file.
  • Keep the tests updated. Fixed issues should generally get a test.

julia-sublime's People

Contributors

315234 avatar albertas-jn avatar epitron avatar fredrikekre avatar jollywatt avatar randy3k avatar rjkat avatar sethblumberg avatar t-bltg avatar viktorqvarfordt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

julia-sublime's Issues

Indentation broken after one-line for..end and if..end blocks

Indentation is broken after one-line for..end and if..end blocks. "Reindent Lines" results in this:

function func(n)
    a = 0
    for i in 0:n a = a + i; end
        return a
    end

Last two lines are over-indented. Same for if...end.


Sublime Text 3.0, Julia-sublime 2017.08.25.20.37.31

Auto-indentation not working

Auto-indentation is broken for me on SublimeText3. It's been broken for a couple of weeks I think:

screen shot 2016-05-16 at 19 24 13

If I switch to a different language (Matlab, Python) indentation works.

Automatic indentation after specific keywords

I have trouble with indentation of code using struct, mutable struct and do.
Sublimetext does not indent the line following one of those keywords. The first two seem to be undefined in indentation but do is defined but does not trigger indentation.

Comments not matching correct

Similar as in #13, doesn't match a comment without the space in between (for both line comment and block comment), see picture on line 7-8, 13-15. I tried to fix it and make a PR but scratching my head why this is not capturing the case on line 7-8.
comment

`=` changes highlighting depending on spaces?

For example:

screen shot 2016-08-05 at 6 19 51 pm

This is when I install the latest through Package Manger with sublime. Not sure if this is already fixed but not on a tagged release? Or is this intentional?

Thanks for your support on this.

matrix inverse syntax

Hi, thanks for the package! There seems to be a bug in the version I installed today (via Sublime Packages) with matrix inversion syntax. The matrix inversion apostrophe gets parsed as a string apostrophe. (See, e.g. julia/examples/colorimetry.jl.)

    rgbxyzsc = [(rgbxyz[1,:] ./ rgbw[1])';
                (rgbxyz[2,:] ./ rgbw[2])';
                (rgbxyz[3,:] ./ rgbw[3])']

All subsequent code in the file has string-like syntax highlighting.

bug in folding for functions with arguments over multiple lines

As the title says, it seems folding is not properly performed for functions with arguments distributed over multiple lines, see attached picture, showing the function repeated twice for convenience, with the first occurence folded.

screen shot 2016-02-06 at 20 46 44

Thanks for the great package.

Wrong LaTeX completion

I'm using Sublime Text 3 build 3126 on macOS Sierra. When I execute \mu+[tab] I get ๐‘ˆ. I haven't noticed any other problems with completion and it works in the REPL.

Unicode completion

Would it be possible to have Unicode completion in the search window? (i.e. the window that appears after CMD+F)

Number after `e`

The combination of e and a number seem to be incorrectly highlighted? Does not happen with other letters, this probably happens because e on its own is highligted as the constant?

screenshot from 2017-04-25 08-51-25

Can you share font name from screenshot?

I know it's unrelated post but couldn't help asking, can you share the name of the font you're using in screenshot from README.md? I'd really appreciate if you do.

screenshot

println("sqrt(4) = 2") messes up the new syntax highlighting

Hi,
and thanks for your efforts to improve the julia/sublime cooperation.

I've noticed that the newest version (v2016.08.14...) causes some problems on my Win7 machine.
For instance, the lines

println("sqrt(4) = 2")
a0 = 1

show everything from 2 and onward in red (string, I think).

Btw. the Julia package seems to update itself. Why is that?

Best, Paul S

transpose sign problem

I have noticed the following problem.
Please, could you have a look at it?

b = transpose(a)
This line does not cause any harm.

b = a'
But this line switches off syntax highlighting for the code that follows.
Syntax highlighting only comes back after a second transpose sign occurs.

Use of = in a string

Using = in a string for calling a function with a parenthesis makes the parser believe it is a function definition instead of a function call.

screen shot 2016-08-26 at 16 14 29

Colored whitespace after function keyword

If the setting to draw white space is turned on in sublime ("draw_white_space": "selection" or "draw_white_space": "all") the space-dot after function is colored with the same color as the function keyword.
Here the dot is red:
reddot

Optional arguments sometimes cause highlighting issues

The first line below looks good, but the z in the second line should be orange. I think the problem generally occurs when you call a function (here the constructor MyType()) while defining default values. (Not so sure about this anymore, see below)

screen shot 2016-08-27 at 4 02 05 pm

Rewrite Julia.tmLanguage to Julia.sublime-synax

The develop branch now contains a rewrite from Julia.tmLanguage to Julia.sublime-synax. It fixes and improves a lot of things.

  • Syntax parsing is much easier and flexible, allows for more complex highlighting and easier maintenance.
  • Improved syntax highlighting for all sorts of declarations (types, functions, macros). Parameters in function and macro definitions are highlighted.
  • String interpolation is highlighted for double quoted strings (without string modifiers, this can of course be enabled for all strings). Do we want this? Check it out.
  • Proper automated syntax tests in syntax_test_julia.jl (Run tests by running the build command.)
  • Julia.tmLanguage will be kept for backward compatibility. The sublime-syntax format was introduced in sublime text build 3084 more than a year ago.

Check it out by cloning the repo into .../sublime_path/Packages/ and checkout develop.

Comments, thoughts and reactions to this?

Broken multiline regex syntax highlighting

The $ at the end of a regex with triple quotes breaks the syntax highlighting.

r"\n a \" b $"x  # Works.
r"""\n a \" b $"""x  # Broken.

print("""Hello World""")  # Messed up.

The $ makes the syntax highlighter think """x is a variable so the multiline string doesn't end.

julia highlight is not coherent with other language syntaxes

  • don't highlight variables
  • regular function call should be variable.function only and the arguments should be meta.function-call.arguments variable.parameter
  • supported function should be support.function only and parameters should be meta.function-call.arguments variable.parameter.

screen shot 2017-03-22 at 5 30 29 pm

** Updated screenshot for julia**

screen shot 2017-03-22 at 6 55 56 pm

Triple quote strings

This is a somewhat bizarre case I found while viewing this in sublime. Seems to be that a double quote (") can end a triple quote (""") segment, but only if string interpolation is used within the string.
longstring

Conversion between unicodes and Greek letters

@ViktorQvarfordt

I have justed add a conversion functionality in UnicodeCompletion which basically converts between \alpha and ฮฑ, which is quite useful in LaTeX documents. However, while I am writing a julia script file, I usual have

mu = 0
sigma = 1
z = sqrt(mu/sigma)

It would be interesting to convert this to

ฮผ = 0
ฯƒ = 1
z = โˆš(ฮผ/ฯƒ)

So the questions are

  1. Shall we ship this functionality in this package or a separate package?
  2. Obviously, not all symbols should be supported, besides greeks, what symbols should be included?

Inconsistency in highlighting function declaration

In the scope of #21 we currently

image

Fixing this requires some elaborate trickery with lookahead regexes, which are needed to distinguish a function call from an assignment-form function declaration. The issue is the round parenthesis inside the type annotation.

Color macro calls?

Currently all macros are set in plain color for me. It would be nice if it had a prettier color default

Commas are highlighted as part of functions

See the last line here. I think the x and the comma should be white. Thanks again -- all your fixes are working for me and are well appreciated ๐Ÿ˜„

screen shot 2016-08-08 at 10 28 05 am

Perhaps it thinks x,f is the function name, which should be an easy fix?

screen shot 2016-08-08 at 10 31 51 am

How to handle highlighting Modules?

I also added this to the wiki:

screen shot 2016-08-09 at 7 13 04 pm

I think it would make sense for MyModule to inherit the same color as MyType/myfunc in these examples. When you are overloading an imported function, everything looks ๐Ÿ‘ to me -- we want something similar for the examples above:

screen shot 2016-08-09 at 7 16 04 pm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.