By default, a predefined library is enabled in the scope of the whole current project. A predefined library can be associated with another scope or disabled entirely but it cannot be removed.
AppCode uses external libraries only to enhance coding assistance (that is, code completion, syntax highlighting, navigation, and documentation lookup). The mechanism of external libraries is not a way to manage your project dependencies.
Each AppCode library is characterized by its scope and visibility status.
- The scope of a library defines the set of files and folders in which the library is considered as library, that is, it is write-protected and excluded from code analysis and refactoring contrary to your project code that you edit.
- The visibility status of a library determines whether it is used in the current project only (Project) or can be associated with any other AppCode project (Global). A Global library itself can be located wherever you need, its settings are stored with other AppCode settings in the dedicated directories under the AppCode home directory.
Using TypeScript community stubs (TypeScript definition files)
To download TypeScript definitions for a library or framework
Place the cursor at the
- Click Download on the toolbar. The Download Library dialog opens.
- Choose TypeScript community stubs from the drop-down list, select the required library, and click Download and Install. AppCode downloads the type definitions for the selected library and shows them under the External Libraries node.
Configuring a node_modules library
AppCode automatically marks the
node_modules folder as a predefined library. This lets you get code completion for Node.js modules and keep them in your project. At the same time, AppCode does not run any inspections against them which improves performance. The
node_modules folder is added to the list of libraries automatically: In the Project tool window, the
node_modules is also marked as a library:
Configuring HTML and Node.js Core Libraries
- Clear the Enabled checkboxes next to HTML and Node.js Core items.
- To configure the scope for the HTML library, click , select the folders with the client-side code, and then choose HTML from the Library drop-down list.
- To configure the scope for the Node.js Core library, click again, select the folders with the server-side code, and choose Node.js Core from the Libraries drop-down list.
Configuring a library added via a CDN link
When a library
.js file is referenced through a CDN link, it is available for the runtime but is invisible for AppCode. To add the objects from such library
.js file to completion lists, download the file and configure it as an external library.
To download a library
- Download the required framework file.
- By default, the library is Global, which means that you can attach it to any other project. To suppress re-using a library, choose Project in the New Library dialog.
- By default, the library is enabled in the scope of the whole current project. You can change this default setting as described in Changing the scope of a library.
- In the Documentation URLs area, specify the path to the official documentation of the library or framework. AppCode will open this URL when you press ⇧F1 on a symbol from this library.
Viewing the libraries associated with a file
- Open the file in the editor and click on the Status bar. AppCode opens a pop-up window that lists the libraries associates with the current file.
- To change the list, click the Libraries in scope links and edit the scope settings in the Manage Scope dialog that opens.
Changing the scope of a library
- For each added file or a folder, from the Library list, select the library which you are configuring.
Deleting a library
- Select the required library and click Remove.