Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Code formatting erases subscripts on operators #435

Closed
maikonaraujo opened this issue Nov 23, 2019 · 9 comments
Closed

[BUG] Code formatting erases subscripts on operators #435

maikonaraujo opened this issue Nov 23, 2019 · 9 comments
Labels

Comments

@maikonaraujo
Copy link

maikonaraujo commented Nov 23, 2019

Please search existing issues to avoid duplicates.

Details

  • Atom version: 1.39.0 x64
  • Julia version: 1.2
  • OS: Ubuntu
  • Package versions:
    • Atom.jl:
    • julia-client:
    • ink:

Steps to reproduce

  1. Type a operator with a subscript:
    2.0 |>ᵦ sin
  2. Select the code and press Ctrl+J+F (format shortcut), it erases the beta subscript leaving:
    2.0 |> sin

It is a problem when you implement an operator with a subscript and it get changed when you format your code.

Thanks,

@aviatesk
Copy link
Member

I can't reproduce this. What version of Atom.jl are you using ?
Tell us back what Julia-Client: Debug-Info says.

image

@maikonaraujo
Copy link
Author

Atom:

Version: 1.39.0
Dev Mode: false
Official Release: true
{
"http_parser": "2.8.0",
"node": "10.2.0",
"v8": "6.6.346.32",
"uv": "1.20.3",
"zlib": "1.2.11",
"ares": "1.14.0",
"modules": "64",
"nghttp2": "1.29.0",
"napi": "3",
"openssl": "1.1.0h",
"electron": "3.1.10",
"chrome": "66.0.3359.181"
}

julia-client:

Version: 0.11.3
Config:
{
"firstBoot": false,
"juliaOptions": {
"startupArguments": [
"-q"
]
},
"uiOptions": {
"enableMenu": true,
"enableToolBar": true
}
}

ink:

Version: 0.11.6
Config:
undefined

uber-juno:

Version: 0.3.0
Config:
{
"disable": true
}

language-julia:

Version: 0.19.1
Config:
undefined

language-weave:not installed

indent-detective:

Version: 0.4.0
Config:
undefined

latex-completions:

Version: 0.3.6
Config:
undefined

versioninfo():

Julia Version 1.2.0
Commit c6da87ff4b (2019-08-20 00:03 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.1 (ORCJIT, broadwell)
Environment:
JULIA_EDITOR = atom -a
JULIA_NUM_THREADS = 2

Status `~/.julia/environments/v1.2/Project.toml`

[c52e3926] Atom v0.11.3
[e5e0dc1b] Juno v0.7.2

@maikonaraujo
Copy link
Author

maikonaraujo commented Nov 24, 2019

you just type something like +\_beta(tab) than format the code.

@aviatesk
Copy link
Member

we internally use JuliaFormatter package, and maybe this bug is fixed within its latest releases.
Try

pkg> up

and then restart julia, and do the format.

@maikonaraujo
Copy link
Author

Just updated as you suggested and same thing is still happening. It is not for all unicode, but when it is used as subscript on operators like:
+\_beta(tab)
Thanks,

Atom:

Version: 1.39.0
Dev Mode: false
Official Release: true
{
"http_parser": "2.8.0",
"node": "10.2.0",
"v8": "6.6.346.32",
"uv": "1.20.3",
"zlib": "1.2.11",
"ares": "1.14.0",
"modules": "64",
"nghttp2": "1.29.0",
"napi": "3",
"openssl": "1.1.0h",
"electron": "3.1.10",
"chrome": "66.0.3359.181"
}

julia-client:

Version: 0.11.3
Config:
{
"firstBoot": false,
"juliaOptions": {
"startupArguments": [
"-q"
]
},
"uiOptions": {
"enableMenu": true,
"enableToolBar": true
}
}

ink:

Version: 0.11.7
Config:
undefined

uber-juno:

Version: 0.3.0
Config:
{
"disable": true
}

language-julia:

Version: 0.19.2
Config:
undefined

language-weave:not installed

indent-detective:

Version: 0.4.0
Config:
undefined

latex-completions:

Version: 0.3.6
Config:
undefined

versioninfo():

Julia Version 1.2.0
Commit c6da87ff4b (2019-08-20 00:03 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.1 (ORCJIT, broadwell)
Environment:
JULIA_NUM_THREADS = 2

Status `~/.julia/environments/v1.2/Project.toml`

[c52e3926] Atom v0.11.3
[e5e0dc1b] Juno v0.7.2

@aviatesk
Copy link
Member

what does

pkg> add JuliaFormatter
pkg> st

print ?

@maikonaraujo
Copy link
Author

Just try the line below:
+₁ +₂ +ₐ +₊

(v1.2) pkg> st
    Status `~/.julia/environments/v1.2/Project.toml`
  [c52e3926] Atom v0.11.3
  [98e50ef6] JuliaFormatter v0.1.19
  [e5e0dc1b] Juno v0.7.2

@aviatesk
Copy link
Member

aviatesk commented Nov 24, 2019

ok, I figured out what happening:
JuliaFormatter≥0.1.20 requires CSTParser≥1.0.0, but the latest Atom still requires CSTParser≤0.6.3

This is already resolved within our current master branch, so the quick fix for you is

pkg> add Atom#master
pkg> add Juno#master
pkg> add JuliaFormatter#master

We may bump Atom.jl version in the near future though.

@maikonaraujo
Copy link
Author

That fixed the problem! Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants