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

Make project-specific "compilePaths" relative, to the project #164

Open
garyking opened this issue Jul 22, 2014 · 9 comments
Open

Make project-specific "compilePaths" relative, to the project #164

garyking opened this issue Jul 22, 2014 · 9 comments

Comments

@garyking
Copy link

For "compilePaths" specified in a project-specific setting file, can the paths please be allowed to be specified as relative paths to the project's root directory, rather than absolute paths?

@markalfred
Copy link
Contributor

This should have been added with e5d696d -- can you describe your setup so we can try to find where the bug is?

@garyking
Copy link
Author

I have a project with path (as an example): /Users/gary/Sites/test as specified in the Sublime project file. Then I have settings -> CoffeeScript -> compilePaths -> "Testing/coffeescript": ".." (just using shorthand for the JSON, but the last line is exactly the same), but when I save a CS file in the Testing/coffeescript dir, it doesn't generate the JS in the Testing dir (after saving). Rather, it generates it in the coffeescript dir (i.e. .).

I'm on the latest Mac OS X, using the latest ST3.

If I'm reading that commit right, does it get the project path from the location of the project file? If so, then shouldn't it be getting the project path from the folders -> path value instead? And if not, then nevermind. (Perhaps it's just the open file's path?)

Also, the default settings file for this package (in ST3) is not very clear when it comes to the settings compilePaths and relativeDir (the latter which isn't documented at all in the current settings file, although it is mentioned on the website).

@garyking garyking reopened this Aug 25, 2014
@markalfred
Copy link
Contributor

With this .sublime-project file:

{
    "folders":
    [
        {
            "follow_symlinks": true,
            "path": "."
        }
    ]
}

And this CoffeeScript.sublime-settings

{
  "compileOnSave": true,
  "compilePaths": {
    "test/coffee": ".."
  }
}

I save ~/test/coffee/foo.coffee and end up with ~/test/foo.js

Are there any other relative or absolute paths that might be matching the files you're saving? Can you paste the contents of your sublime-settings and sublime-projects files?

@garyking
Copy link
Author

I don't keep my project file in the same dir as the project itself because I keep all my project files in the same folder. So, I use an absolute path for the project. Here is my file, including project-specific CS settings:

{
  "folders":
  [
    {
      "follow_symlinks": true,
      "path": "/Users/gary/scripts"
    }
  ],
  "settings":
  {
    "CoffeeScript":
    {
      "compileOnSave": true,
      "compilePaths":
      {
        "/Users/gary/scripts/coffeescript": ".."
      }
    }
  }
}

This file works. But if I use "coffeescript": ".." instead then it doesn't work.

@exromany
Copy link
Contributor

If all your .coffee files placed in same folder, you may specify

    "settings":
    {
        "CoffeeScript":
        {
            "compileOnSave": true,
            "compileDir": ".."
        }
    }

This will compile .js file at one level up from .coffee files

@garyking
Copy link
Author

Unfortunately not all my .coffee files are in the same dir. I want all .coffee files to be compiled in their same dir (so therefore, no settings necessary), but for files in a specific folder, I want them to be compiled in another specific folder.

@markalfred
Copy link
Contributor

{
    "folders":
    [
        {
            "follow_symlinks": true,
            "path": "/Users/mark/scripts"
        }
    ],
    "settings":
    {
        "CoffeeScript":
        {
            "compileOnSave": true,
            "compilePaths":
            {
                "Testing/coffeescript": ".."
            }
        }
    }
}

With this setup, I save /Users/mark/scripts/Testing/coffeescript/x.coffee, and I end up with /Users/mark/scripts/Testing/x.js.

Do you have any compilePaths defined in ~/Library/Application Support/Sublime Text 3/Packages/User/CoffeeScript.sublime-settings?

@markalfred
Copy link
Contributor

Also, and this may seem obvious, but the .coffee file you're saving isn't in /Testing/coffeescript/coffeescript, right? Because that would cause this exact issue (ie. folder hierarchy is retained).

@garyking
Copy link
Author

I've got the exact same project file as you (except gary instead of mark), and when I created the x.coffee in Testing/coffeescript it was created in the same dir, rather than the parent dir. I confirmed that I typed everything in correctly by replacing the Testing/coffeescript with an absolute path, and that worked.

The file I tested was /Users/gary/scripts/Testing/coffeescript/x.coffee.

I don't have compilePaths defined anywhere else.

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