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

Add line number in code editor #68

Open
ad-ops opened this issue Mar 24, 2024 · 7 comments
Open

Add line number in code editor #68

ad-ops opened this issue Mar 24, 2024 · 7 comments

Comments

@ad-ops
Copy link

ad-ops commented Mar 24, 2024

For longer examples or when user pastes their own code and get and error or warning it would be helpful to be able to use the line number provided by the compiler.

For example from the first example on https://tour.gleam.run/basics/hello-world/:

import gleam/io

pub fn main() {
  io.println(4)
}
error: Type mismatch
  ┌─ /src/main.gleam:4:14
  │
4 │   io.println(4)
  │              ^

Expected type:

    String

Found type:

    Int
@lpil
Copy link
Member

lpil commented Mar 24, 2024

Sorry, what do you mean? The line number is in the error there

@ad-ops
Copy link
Author

ad-ops commented Mar 24, 2024

sorry, I meant the editor and that it would be helpful since it is in the error message:

image

Should be something like this:

image

or perhaps add an option to show it if it is to distracting in the tour.

@lpil
Copy link
Member

lpil commented Mar 25, 2024

Ah I see! The editor we're using doesn't support this I believe. If we add it we'd need to have it be an opt-in feature and we'll need some visual design to work out where to put this config, so it's not a straightforward addition.

@samifouad
Copy link

samifouad commented Mar 27, 2024

i was able to do some playing around in chrome devtools and found out where we would need to modify the code to enable it

would need to be enabled inside /static/index.js and some css added at the bottom of static/css/code/syntax-highlight.css

not sure yet how to go about with togging it on/off, but there must be some way to programmatically modify the editor instance

Screenshot from 2024-03-27 07-02-12
Screenshot from 2024-03-27 07-02-31

@samifouad
Copy link

here's what it looked like in both themes

Screenshot from 2024-03-27 07-03-28
Screenshot from 2024-03-27 07-03-22

@lpil
Copy link
Member

lpil commented Mar 27, 2024

Oh wow, it is supported! Neat! I couldn't find it in the documentation.

@samifouad
Copy link

me neither hah

also i think hiding the line number column via css would work. just not sure how to approach a toggle icon because that top right corner is beautiful and i would definitely ruin it with my design skills 😄

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

No branches or pull requests

3 participants