Skip to content
This repository has been archived by the owner on Oct 10, 2018. It is now read-only.

Commit

Permalink
feat: add multi root workspace support (#325)
Browse files Browse the repository at this point in the history
closes #283.
  • Loading branch information
buehler committed Oct 26, 2017
1 parent 8019e80 commit 219389f
Show file tree
Hide file tree
Showing 47 changed files with 1,077 additions and 756 deletions.
10 changes: 3 additions & 7 deletions .travis.yml
Expand Up @@ -7,10 +7,6 @@ node_js:
notifications:
email: false

env:
global:
- CODE_TESTS_WORKSPACE=$TRAVIS_BUILD_DIR/test/_workspace

os:
- linux

Expand All @@ -32,8 +28,8 @@ addons:
before_install:
- if [ $TRAVIS_OS_NAME == "linux" ]; then
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start;
sleep 3;
sh -e /etc/init.d/xvfb start;
sleep 3;
fi
- rvm get stable
- rvm install 2.4
Expand All @@ -42,7 +38,7 @@ before_install:

install:
- yarn install

before_script:
- greenkeeper-lockfile-update
- yarn run build
Expand Down
35 changes: 33 additions & 2 deletions .vscode/launch.json
Expand Up @@ -17,14 +17,45 @@
]
},
{
"name": "Launch Tests",
"name": "Launch Extension Multi-Root",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceRoot}/test/multi-root.code-workspace",
"--extensionDevelopmentPath=${workspaceRoot}"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/out/src/**/*.js"
]
},
{
"name": "Launch Tests (single Workspace)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceRoot}/test/_workspace",
"--extensionDevelopmentPath=${workspaceRoot}",
"--extensionTestsPath=${workspaceRoot}/out/test"
"--extensionTestsPath=${workspaceRoot}/out/test/single-workspace-tests/"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/out/test/single-workspace-tests/**/*.js"
]
},
{
"name": "Launch Tests (multi-root Workspace)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceRoot}/test/multi-root.code-workspace",
"--extensionDevelopmentPath=${workspaceRoot}",
"--extensionTestsPath=${workspaceRoot}/out/test/multi-root-workspace-tests/"
],
"stopOnEntry": false,
"sourceMaps": true,
Expand Down
6 changes: 4 additions & 2 deletions config/tsconfig.base.json
Expand Up @@ -4,7 +4,8 @@
"target": "es6",
"outDir": "../out",
"lib": [
"es6"
"es6",
"es2017"
],
"rootDir": "..",
"emitDecoratorMetadata": true,
Expand All @@ -20,6 +21,7 @@
"../test/**/*"
],
"exclude": [
"../test/_workspace"
"../test/_workspace",
"../test/_workspace_2"
]
}
61 changes: 39 additions & 22 deletions package.json
Expand Up @@ -10,7 +10,7 @@
"version": "0.0.0-development",
"publisher": "rbbit",
"engines": {
"vscode": "^1.13.0",
"vscode": "^1.17.0",
"node": ">=8.0.0",
"npm": ">=5.3.0"
},
Expand Down Expand Up @@ -80,13 +80,15 @@
"predevelop": "del-cli ./out",
"develop": "tsc",
"postinstall": "test -f ./node_modules/vscode/bin/install && node ./node_modules/vscode/bin/install || echo 'vscode/bin/install not found'",
"pretest": "del-cli ./out && tsc -p ./config/tsconfig.test.json && yarn run lint",
"test": "node ./node_modules/vscode/bin/test",
"lint": "tslint -c tslint.json --project ./config/tsconfig.build.json",
"pretest": "del-cli ./out && tsc -p ./config/tsconfig.test.json && yarn lint",
"test": "yarn test:single-workspace",
"test:single-workspace": "CODE_TESTS_WORKSPACE=$(pwd)/test/_workspace CODE_TESTS_PATH=$(pwd)/out/test/single-workspace-tests node ./node_modules/vscode/bin/test",
"test:multi-workspace": "CODE_TESTS_WORKSPACE=$(pwd)/test/multi-root.code-workspace CODE_TESTS_PATH=$(pwd)/out/test/multi-root-workspace-tests node ./node_modules/vscode/bin/test",
"build": "del-cli ./out && tsc -p ./config/tsconfig.build.json",
"package": "yarn run build && del-cli './*.vsix' && vsce package",
"package": "yarn build && del-cli './*.vsix' && vsce package",
"semantic-release-pre": "semantic-release pre",
"semantic-release": "yarn run semantic-release-pre && vsce package && vsce publish -p $VSCE_TOKEN && yarn install && semantic-release post"
"semantic-release": "yarn semantic-release-pre && vsce package && vsce publish -p $VSCE_TOKEN && yarn install && semantic-release post"
},
"devDependencies": {
"@types/chai": "^4.0.4",
Expand Down Expand Up @@ -199,33 +201,38 @@
"All"
],
"default": "Warnings",
"description": "Defines the log output level in the output window."
"description": "Defines the log output level in the output window.",
"scope": "window"
},
"typescriptHero.completionSortMode": {
"typescriptHero.codeCompletion.completionSortMode": {
"enum": [
"default",
"bottom"
],
"default": "default",
"description": "Import completion sort order"
"description": "Defines the sortmode of the code completion in intellisense (bottom means sorted to bottom).",
"scope": "resource"
},
"typescriptHero.resolver.insertSpaceBeforeAndAfterImportBraces": {
"type": "boolean",
"default": true,
"description": "Defines if there should be a space inside the curly braces of an import statement."
"description": "Defines if there should be a space inside the curly braces of an import statement.",
"scope": "resource"
},
"typescriptHero.resolver.insertSemicolons": {
"type": "boolean",
"default": true,
"description": "Defines if there should be a semicolon at the end of a statement."
"description": "Defines if there should be a semicolon at the end of a statement.",
"scope": "resource"
},
"typescriptHero.resolver.stringQuoteStyle": {
"enum": [
"'",
"\""
],
"default": "'",
"description": "Defines if single or double quotes should be used."
"description": "Defines if single or double quotes should be used.",
"scope": "resource"
},
"typescriptHero.resolver.ignorePatterns": {
"type": "array",
Expand All @@ -238,24 +245,28 @@
"out",
"dist"
],
"description": "Defines partial pathes that are ignored during indexing (e.g. 'node_modules' would exclude all modules)."
"description": "Defines partial pathes that are ignored during indexing (e.g. 'node_modules' would exclude all modules).",
"scope": "resource"
},
"typescriptHero.resolver.multiLineWrapThreshold": {
"type": "number",
"minimum": 1,
"multipleOf": 1,
"default": 125,
"description": "Defines the threshold when an import should be wrapped into a multiline import."
"description": "Defines the threshold when an import should be wrapped into a multiline import.",
"scope": "resource"
},
"typescriptHero.resolver.multiLineTrailingComma": {
"type": "boolean",
"default": true,
"description": "Defined if multi line imports contain the last trailing comma."
"description": "Defined if multi line imports contain the last trailing comma.",
"scope": "resource"
},
"typescriptHero.resolver.disableImportsSorting": {
"type": "boolean",
"default": false,
"description": "Defines if sorting is disable during organize imports."
"description": "Defines if sorting is disable during organize imports.",
"scope": "resource"
},
"typescriptHero.resolver.disableImportRemovalOnOrganize": {
"type": "boolean",
Expand All @@ -265,7 +276,8 @@
"typescriptHero.resolver.organizeOnSave": {
"type": "boolean",
"default": false,
"description": "Defines if the imports should be organized on save."
"description": "Defines if the imports should be organized on save.",
"scope": "resource"
},
"typescriptHero.resolver.ignoreImportsForOrganize": {
"type": "array",
Expand All @@ -276,7 +288,8 @@
"default": [
"react"
],
"description": "Defines imports (libraries, so the 'from' part), which are not removed during 'organize imports'."
"description": "Defines imports (libraries, so the 'from' part), which are not removed during 'organize imports'.",
"scope": "resource"
},
"typescriptHero.resolver.importGroups": {
"type": "array",
Expand Down Expand Up @@ -345,26 +358,30 @@
"Modules",
"Workspace"
],
"description": "Defines the groups of the imports ordering. Multiple groups possible, see readme for instructions."
"description": "Defines the groups of the imports ordering. Multiple groups possible, see readme for instructions.",
"scope": "resource"
},
"typescriptHero.resolver.resolverMode": {
"enum": [
"TypeScript",
"ES6",
"Both"
],
"default": "TypeScript",
"description": "Defines the mode of the symbol resolver (i.e. if JavaScript files should be indexed as well (experimental)."
"default": "Both",
"description": "Defines the mode of the symbol resolver. (Note that JavaScript mode only indexes workspace files)",
"scope": "resource"
},
"typescriptHero.resolver.promptForSpecifiers": {
"type": "boolean",
"default": true,
"description": "Defines if typescript hero should ask the user for default specifiers or duplicate specifier aliases."
"description": "Defines if typescript hero should ask the user for default specifiers or duplicate specifier aliases.",
"scope": "window"
},
"typescriptHero.codeOutline.enabled": {
"type": "boolean",
"default": true,
"description": "Defines if the code outline feature (and window) are enabled or not."
"description": "Defines if the code outline feature (and window) are enabled or not.",
"scope": "window"
}
}
}
Expand Down
28 changes: 28 additions & 0 deletions src/common/config/CodeCompletionConfig.ts
@@ -0,0 +1,28 @@
import { Uri } from 'vscode';

/**
* Configuration interface for the code outline feature.
*
* @export
* @interface CodeCompletionConfig
*/
export interface CodeCompletionConfig {
/**
* The given resource URI (if any) for the actual configuration.
* Is needed to determine the actual config values for multi root environments.
*
* @readonly
* @type {Uri}
* @memberof CodeCompletionConfig
*/
resource?: Uri;

/**
* Defines the used completion sort mode (i.e. if the completions should be sorted to the bottom of the list).
*
* @readonly
* @type {('default' | 'bottom')}
* @memberof CodeCompletionConfig
*/
completionSortMode: 'default' | 'bottom';
}
16 changes: 14 additions & 2 deletions src/common/config/CodeOutlineConfig.ts
@@ -1,13 +1,25 @@
import { Uri } from 'vscode';

/**
* Configuration interface for the code outline feature.
*
*
* @export
* @interface CodeOutlineConfig
*/
export interface CodeOutlineConfig {
/**
* The given resource URI (if any) for the actual configuration.
* Is needed to determine the actual config values for multi root environments.
*
* @readonly
* @type {Uri}
* @memberof CodeOutlineConfig
*/
resource?: Uri;

/**
* Defined if the code outline feature is enabled or not.
*
*
* @type {boolean}
* @memberof CodeOutlineConfig
*/
Expand Down
39 changes: 29 additions & 10 deletions src/common/config/ExtensionConfig.ts
@@ -1,26 +1,47 @@
import { Uri } from 'vscode';

import { CodeCompletionConfig } from './CodeCompletionConfig';
import { CodeOutlineConfig } from './CodeOutlineConfig';
import { ResolverConfig } from './ResolverConfig';

/**
* Configuration interface for TypeScript Hero
* Contains all exposed config endpoints.
*
*
* @export
* @interface ExtensionConfig
*/
export interface ExtensionConfig {
/**
* The given resource URI (if any) for the actual configuration.
* Is needed to determine the actual config values for multi root environments.
*
* @readonly
* @type {Uri}
* @memberof ExtensionConfig
*/
resource?: Uri;

/**
* The actual log level.
*
*
* @readonly
* @type {string}
* @memberof ExtensionConfig
*/
verbosity: string;

/**
* Returns a list of possible language IDs that are registered within this extension.
*
* @type {string[]}
* @memberof ExtensionConfig
*/
possibleLanguages: string[];

/**
* Configuration object for the resolver extension.
*
*
* @readonly
* @type {ResolverConfig}
* @memberof ExtensionConfig
Expand All @@ -29,21 +50,19 @@ export interface ExtensionConfig {

/**
* Configuration object for the code outline extension.
*
*
* @readonly
* @type {CodeOutlineConfig}
* @memberof ExtensionConfig
*/
codeOutline: CodeOutlineConfig;

/**
* Completion sorting mode:
* default: Use default VSCode sorting mode
* bottom: Push to bottom
*
* Configuration object for the code completion extension.
*
* @readonly
* @type {'default'|'bottom'}
* @type {CodeCompletionConfig}
* @memberof ExtensionConfig
*/
completionSortMode: 'default' | 'bottom';
codeCompletion: CodeCompletionConfig;
}

0 comments on commit 219389f

Please sign in to comment.