atom-community / autocomplete-paths

Autocomplete Paths for Atom
MIT License
151 stars 62 forks source link

Readme should contain real config.cson examples #196

Open bennypowers opened 6 years ago

bennypowers commented 6 years ago

Description

README.md recommends users add the following to config.cson

"autocomplete-paths":
  scopes: [
    { ... },
    { ... },
  ]

But there's no indication what should be put in each scope. Should it be a complete copy of the settings? what is the name of the scope in that case, scopes?

One or two real world examples would help a lot

bennypowers commented 6 years ago

for example, this configuration is deleted as soon as its saved.

    scopes: [
      {
        scopes: [ 'source.js' ]
        extensions: [ 'html', 'js', 'css', 'scss', 'jpg', 'png', 'svg', 'mjs', 'gif', 'json' ]
      }
    ]
mmkaw commented 6 years ago

i agree with you regarding autocomplete-paths. it took me ~2 hours to figure out. autocomplete-paths main page has an example though https://atom.io/packages/autocomplete-paths scroll down to "defining scopes" also place your scopes right below the "autocomplete-paths": in your "cson file.

mmkaw commented 6 years ago

another example in 2 comment: https://github.com/atom-community/autocomplete-paths/issues/131

ndaman commented 6 years ago

One note that changed my life from the above linked thread: close the settings window when editing config.cson!

samkahchiin commented 4 years ago

One note that changed my life from the above linked thread: close the settings window when editing config.cson!

I spent half a day to figure out why my settings don't work and really get a lot of help from these issues. Thanks, guys.

What happened to me

All of a sudden the autocomplete-path just doesn't work

Tips that work for me

Sample scopes of mine:

"autocomplete-paths":
    scopes: [
      {
        extensions: [
          "js"
          "png"
          "gif"
          "jpeg"
          "jpg"
          "tiff"
          "html"
        ]
        prefixes: [
          "src=['\"]"
          "href=['\"]"
        ]
        relative: true
        scopes: [
          "text.html.basic"
        ]
      }
      {
        extensions: [
          "js"
          "jsx"
          "ts"
          "coffee"
        ]
        includeCurrentDirectory: true
        prefixes: [
          "import\\s+.*?from\\s+['\"]"
          "require\\(['\"]"
          "define\\(\\[?['\"]"
        ]
        projectRelativePath: false
        relative: true
        replaceOnInsert: [
          [
            ".jsx?$"
            ""
          ]
          [
            ".ts$"
            ""
          ]
          [
            ".coffee$"
            ""
          ]
        ]
        scopes: [
          "source.js"
        ]
      }
    ]