Skip to content

Commit d462a2a

Browse files
1. Project refactoring
2. Bazel import wizard. Initial commit
1 parent 1d2798f commit d462a2a

File tree

18 files changed

+1880
-1919
lines changed

18 files changed

+1880
-1919
lines changed

.eslintrc.json

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
11
{
2-
"env": {
3-
"browser": false,
4-
"commonjs": true,
5-
"es6": true,
6-
"node": true,
7-
"mocha": true
8-
},
9-
"parserOptions": {
10-
"ecmaVersion": 2018,
11-
"ecmaFeatures": {
12-
"jsx": true
13-
},
14-
"sourceType": "module"
15-
},
16-
"rules": {
17-
"no-const-assign": "warn",
18-
"no-this-before-super": "warn",
19-
"no-undef": "warn",
20-
"no-unreachable": "warn",
21-
"no-unused-vars": "warn",
22-
"constructor-super": "warn",
23-
"valid-typeof": "warn"
24-
}
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"parserOptions": {
5+
"ecmaVersion": 6,
6+
"sourceType": "module"
7+
},
8+
"plugins": [
9+
"@typescript-eslint"
10+
],
11+
"rules": {
12+
"@typescript-eslint/naming-convention": "warn",
13+
"@typescript-eslint/semi": "warn",
14+
"curly": "warn",
15+
"eqeqeq": "warn",
16+
"no-throw-literal": "warn",
17+
"semi": "off"
18+
}
2519
}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
node_modules
2+
bazel-ls-eclipse
3+
out
4+
dist
25
.vscode-test/
36
*.vsix

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
"dbaeumer.vscode-eslint"
6+
]
7+
}

.vscode/launch.json

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,34 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
15
{
26
"version": "0.2.0",
37
"configurations": [
48
{
59
"name": "Run Extension",
610
"type": "extensionHost",
711
"request": "launch",
8-
"runtimeExecutable": "${execPath}",
912
"args": [
1013
"--extensionDevelopmentPath=${workspaceFolder}"
11-
]
14+
],
15+
"outFiles": [
16+
"${workspaceFolder}/out/**/*.js"
17+
],
18+
"preLaunchTask": "${defaultBuildTask}"
1219
},
1320
{
1421
"name": "Extension Tests",
1522
"type": "extensionHost",
1623
"request": "launch",
17-
"runtimeExecutable": "${execPath}",
1824
"args": [
1925
"--extensionDevelopmentPath=${workspaceFolder}",
20-
"--extensionTestsPath=${workspaceFolder}/test/suite/index"
21-
]
26+
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
27+
],
28+
"outFiles": [
29+
"${workspaceFolder}/out/test/**/*.js"
30+
],
31+
"preLaunchTask": "${defaultBuildTask}"
2232
}
2333
]
2434
}

.vscode/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"files.exclude": {
4+
"out": false // set this to true to hide the "out" folder with the compiled JS files
5+
},
6+
"search.exclude": {
7+
"out": true // set this to false to include "out" folder in search results
8+
},
9+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
10+
"typescript.tsc.autoDetect": "off"
11+
}

.vscode/tasks.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// See https://go.microsoft.com/fwlink/?LinkId=733558
2+
// for the documentation about the tasks.json format
3+
{
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "npm",
8+
"script": "watch",
9+
"problemMatcher": "$tsc-watch",
10+
"isBackground": true,
11+
"presentation": {
12+
"reveal": "never"
13+
},
14+
"group": {
15+
"kind": "build",
16+
"isDefault": true
17+
}
18+
}
19+
]
20+
}

.vscodeignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
.vscode/**
22
.vscode-test/**
3+
out/test/**
4+
src/**
35
test/**
46
.gitignore
57
**/jsconfig.json
68
**/*.map
79
**/.eslintrc.json
10+
.yarnrc
11+
vsc-extension-quickstart.md
12+
**/tsconfig.json
13+
**/.eslintrc.json
14+
**/*.map
15+
**/*.ts
816
gulpfile.js
917
node_modules
1018
bazel-ls-eclipse/**

extension.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

html/editor.html

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Import Bazel project wizard</title>
8+
</head>
9+
10+
<body>
11+
<div>
12+
<input type="text" id="workspaceLocation" name="workspaceLocation" style="width: 50%; height: 1.5em;">
13+
<button id="browseWorkspace" name="browseWorkspace" onclick="onBrowseHandler('browseWorkspace')"
14+
style="height: 1.5em;">Browse...</button>
15+
</div>
16+
17+
<button id="loadModulesBtn" onclick="loadModules()" style="height: 1.5em;">Load modules</button>
18+
<button id="importProjectBtn" onclick="importProject()" style="height: 1.5em;" disabled>Start import</button>
19+
20+
<div id="moduleList" style="width: 100%; height: 50%; overflow-y: scroll;">
21+
</div>
22+
23+
<script>
24+
const vscode = acquireVsCodeApi();
25+
const moduleListDivId = 'moduleList';
26+
27+
window.addEventListener('message', event => {
28+
29+
const message = event.data; // The JSON data our extension sent
30+
31+
switch (message.command) {
32+
case 'setworkspace': {
33+
setLocation("workspaceLocation", message);
34+
break;
35+
}
36+
case 'listModules': {
37+
const modules = message.data;
38+
if (modules != null) {
39+
if (modules.length > 0) {
40+
document.getElementById('importProjectBtn').disabled = false;
41+
}
42+
for (i = 0; i < modules.length; i++) {
43+
const moduleName = modules[i];
44+
const moduleId = moduleListDivId + moduleName;
45+
const divSection = document.getElementById(moduleListDivId);
46+
const cbNode = document.createElement('input');
47+
cbNode.type = 'checkbox';
48+
cbNode.name = moduleId;
49+
cbNode.value = moduleName;
50+
cbNode.id = moduleId;
51+
cbNode.setAttribute('type', 'checkbox');
52+
53+
const labelNode = document.createElement('label');
54+
labelNode.htmlFor = moduleId;
55+
labelNode.appendChild(document.createTextNode(moduleName));
56+
57+
divSection.appendChild(cbNode);
58+
divSection.appendChild(labelNode);
59+
divSection.appendChild(document.createElement('br'));
60+
61+
}
62+
}
63+
break;
64+
}
65+
}
66+
});
67+
68+
function setLocation(elementId, message) {
69+
if (message.data != null) {
70+
document.getElementById(elementId).value = message.data
71+
} else {
72+
document.getElementById(elementId).value = ''
73+
}
74+
}
75+
76+
function onBrowseHandler(cmd) {
77+
vscode.postMessage({
78+
command: cmd
79+
})
80+
}
81+
82+
function importProject() {
83+
const sourceLocation = document.getElementById("workspaceLocation").value;
84+
let modules = [];
85+
const divNode = document.getElementById(moduleListDivId);
86+
const divModuleNodes = divNode.getElementsByTagName('input');
87+
for (i = 0; i < divModuleNodes.length; i++) {
88+
if (divModuleNodes[i].checked) {
89+
const moduleName = divModuleNodes[i].value;
90+
modules.push(moduleName);
91+
}
92+
}
93+
vscode.postMessage({
94+
command: 'importProject',
95+
source: sourceLocation,
96+
modules: modules
97+
})
98+
}
99+
100+
function loadModules() {
101+
const sourceLocation = document.getElementById("workspaceLocation").value;
102+
vscode.postMessage({
103+
command: 'loadModules',
104+
source: sourceLocation
105+
})
106+
}
107+
</script>
108+
</body>
109+
110+
</html>

jsconfig.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)