autocomplete-paths

Adds path autocompletion to autocomplete+

atom-community

956,091

1,874

2.17.0

MIT

GitHub

This package provides the following services:

This package consumes the following services:

autocomplete+ paths suggestions Build Status

Gitter

View the changelog

Adds path autocompletion to autocomplete+ depending on scope and prefix. Supports custom scopes defined by the user.

autocomplete-paths

Features

Installation

You can install autocomplete-paths using the Preferences pane.

Defining scopes

autocomplete-paths triggers whenever a scope matches the current cursor position and scope descriptor. Here is an example for a JavaScript-Scope that supports the ES6 'import' syntax as well as the CommonJS require() syntax and the RequireJS define() syntax:

{
  scopes: ['source.js'], // Only triggers in JS files
  prefixes: [
    'import\\s+.*?from\\s+[\'"]', // import foo from '
    'require\\([\'"]', // require('
    'define\\(\\[?[\'"]' // define([' or define('
  ],
  extensions: ['js', 'jsx', 'ts', 'coffee'], // Only shows JS / TS / Coffee files
  relative: true, // Inserts relative paths only - defaults to true
  includeCurrentDirectory: true, // Include './' in path - defaults to true
  projectRelativePath: false, // Includes full relative path starting after the project directory
  replaceOnInsert: [ // Replaces the file extensions on insert
    ['.jsx?$', ''],
    ['.ts$', ''],
    ['.coffee$', '']
  ]
}

You can add custom scopes by adding them to your config.cson file:

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