Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

open a file at a specific line #7342

Closed
Closed

Description

@X-G

Running atom file.tex:100, Atom will open a file called atom file.tex:100 rather than open file.tex at line 100
qq 20150619115603
.

Activity

  1. maxbrunsfeld commented on Jun 19, 2015

    @maxbrunsfeld
    Contributor

    I can't reproduce this; for me, it goes to line 100 of the file. What OS and Atom version are you using? Does this happen if you run Atom with atom --safe?

  2. X-G commented on Jun 20, 2015

    @X-G
    Author

    I'm using Windows10 and Atom 0.210.
    And yes, this will happen even if I run atom --safe file.tex:100.

  3. lee-dohm commented on Jun 20, 2015

    @lee-dohm
    Contributor

    Reproduced using Atom v0.211.0-fc4f2a1 on Mac OS X 10.10.3.

    Steps to Reproduce

    1. Change directory to $HOME
    2. Execute mkdir temp
    3. Execute touch temp/file.tex
    4. Works as expected: Start Atom with atom temp/file.tex:100
    5. Close Atom with Cmd+Q
    6. Change directory to $HOME/temp
    7. Start Atom with atom file.tex:100

    Expected: Atom opens with the file.tex file already open
    Actual: Atom opens with a new file called file.tex:100 already open

  4. izuzak commented on Jun 22, 2015

    @izuzak
    Contributor

    Thanks for the reproduction steps, @lee-dohm. ❤️

    @maxbrunsfeld @mostafaeweda As far as I can tell, the reason why this is happening is here:

        return {pathToOpen} if url.parse(pathToOpen).protocol?

    For a path like foo.txt:100, url.parse(pathToOpen).protocol returns foo.txt:, so the check succeeds and the full path is returned (including :100), and the logic for splitting the path by : isn't even reached.

    Wondering if we can work around this case somehow? /cc #6978 where this was added.

  5. maiklos commented on Jun 25, 2015

    @maiklos

    same for me on ubuntu linux.
    echo "a\nb\nc\n" > somefile.txt
    atom somefile.txt:3

    result: opens "somefile.txt:3"
    note: "somefile.txt:3" is valid filename under linux
    I tried some other linux editors (emacs, vim) and they behave exactly same.

    How about to use vim syntax ? instead of :x +x ?
    see here: http://www.cyberciti.biz/faq/linux-unix-command-open-file-linenumber-function/

  6. Flonker commented on Jul 1, 2015

    @Flonker

    Hi!

    Atom 1.0.0 on Windows 7 pro here.
    No matter how I open the file it allways opens a new file with the ":linenumber".

    image

    Both tries open a new file called "test.txt:5" according to this screenshot.

    image

    This is the file:
    image

  7. samachr commented on Jul 2, 2015

    @samachr

    Same problem here. Really would like to use this feature. Also happens when opening with absolute paths instead of relative.

  8. X-G commented on Jul 2, 2015

    @X-G
    Author

    +1

  9. m0nhawk commented on Jul 6, 2015

    @m0nhawk

    Same problem for me. Hope this will be fixed soon.

  10. self-assigned this
    on Jul 6, 2015
  11. doggan commented on Aug 17, 2015

    @doggan

    Same issue here. It works properly with some files, and not for other files. I can't figure out what is different in the cases where it works vs when it doesn't work. 😢

    Using Atom 1.0.7 on Mac OS X (10.10.5).

  12. doggan commented on Aug 18, 2015

    @doggan

    It seems to work for files with an underscore in their name.

    This doesn't work (opens up a file called dummy1.txt:2 or dummy-1.txt:2):

    shyam@shyam-mac:~$ printf "a\nb\nc\n" > dummy1.txt
    shyam@shyam-mac:~$ atom dummy1.txt:2
    
    shyam@shyam-mac:~$ printf "a\nb\nc\n" > dummy-1.txt
    shyam@shyam-mac:~$ atom dummy-1.txt:2
    

    This works (opens up dummy_1.txt to line 2):

    shyam@shyam-mac:~$ printf "a\nb\nc\n" > dummy_1.txt
    shyam@shyam-mac:~$ atom dummy_1.txt:2
    

    Hopefully that is helpful info 👀

  13. jgable commented on Aug 19, 2015

    @jgable

    @doggan 👍 The prepend an underscore to the file workaround also worked for me.

  14. m0nhawk commented on Aug 30, 2015

    @m0nhawk

    @doggan It doesn't work for me under Windows with latest (1.0.9) Atom. Thus, it's not a fixed issue and hardly be called a workaround.

  15. doggan commented on Aug 30, 2015

    @doggan

    @m0nhawk I don't see anyone claiming it is fixed, hence the reason this issue is still open. My comment was to provide repro information.

  16. Xcodo commented on Aug 31, 2015

    @Xcodo

    +1

    Same for me on Windows with Atom 1.0.9.

    This is my only issue with moving to Atom at the moment from a combination of Notepad++ and BowPad. Being able to just to specific error lines from an IDE is a massive time saver.

  17. maxbrunsfeld commented on Sep 3, 2015

    @maxbrunsfeld
    Contributor

    ⚡ @izuzak Thanks so much for tracking this down.

  18. lock commented on Jan 20, 2019

    @lock

    This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

  19. locked as resolved and limited conversation to collaborators on Jan 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions