Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 43 additions & 18 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
{
"version": "0.2.0",
"inputs": [
{
"id": "testWorkspace",
"type": "promptString",
"description": "Absolute path to the folder to open in the Extension Development Host",
"default": "${workspaceFolder}"
}
],
"configurations": [
{
"name": "Launch Client",
Expand All @@ -10,31 +18,48 @@
"--extensionDevelopmentPath=${workspaceRoot}"
],
"outFiles": [
"${workspaceRoot}/out/**/*.js",
"${workspaceRoot}/out/**/*.js"
],
"preLaunchTask": {
"type": "npm",
"script": "watch"
}
},
{
"name":"Attach to ELS Server",
"type":"node",
"request":"attach",
"port":6004,
"sourceMaps":true,
"outFiles":[
"${workspaceRoot}/node_modules/@ember-tooling/ember-language-server/lib/**/*.js"
"name": "Launch Client (prompt for folder)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}",
"${input:testWorkspace}"
],
"outFiles": [
"${workspaceRoot}/out/**/*.js"
],
"restart":true,
"smartStep":true
}
"preLaunchTask": {
"type": "npm",
"script": "watch"
}
},
{
"name": "Attach to ELS Server",
"type": "node",
"request": "attach",
"port": 6004,
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/node_modules/@ember-tooling/ember-language-server/lib/**/*.js"
],
"restart": true,
"smartStep": true
}
],
"compounds": [
{
"name": "Client + Server",
"configurations": ["Launch Client", "Attach"], //"Attach" is in ember-language-server project
"stopAll": true,
}
]
"compounds": [
{
"name": "Client + Server",
"configurations": ["Launch Client", "Attach"],
"stopAll": true
}
]
}
15 changes: 13 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@
"onLanguage:typescript",
"onLanguage:glimmer-js",
"onLanguage:glimmer-ts",
"workspaceContains:ember-cli-build.js",
"workspaceContains:**/ember-cli-build.js",
"workspaceContains:**/ember-cli-build.cjs",
"workspaceContains:**/node_modules/ember-source/package.json",
Comment thread
evoactivity marked this conversation as resolved.
"workspaceContains:**/node_modules/ember-template-lint/package.json",
"workspaceContains:**/node_modules/ember-template-imports/package.json",
"workspaceContains:**/node_modules/content-tag/package.json",
"workspaceContains:**/node_modules/@glimmerx/core/package.json",
"onCommand:els.runInEmberCLI"
],
"contributes": {
Expand Down Expand Up @@ -101,6 +107,11 @@
"type": "boolean",
"default": true,
"description": "Folding range provider for .hbs files, disabling may improve startup performance for very large projects"
},
"els.detection.forceEnable": {
"type": "boolean",
"default": false,
"description": "Bypass Ember project detection and always start the language server. Useful for exotic monorepo layouts (e.g. pnpm setups) where automatic detection fails."
}
}
},
Expand Down Expand Up @@ -148,7 +159,7 @@
},
"devDependencies": {
"@types/mocha": "^2.2.33",
"@types/node": "^6.0.52",
"@types/node": "^14.18.63",
Comment thread
evoactivity marked this conversation as resolved.
"@types/vscode": "1.60.0",
"@typescript-eslint/eslint-plugin": "^5.33.1",
"@typescript-eslint/parser": "^5.33.1",
Expand Down
15 changes: 9 additions & 6 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ import {
workspace,
ExtensionContext,
StatusBarItem,
OutputChannel,
window,
commands,
languages,
InputBoxOptions,
StatusBarAlignment,
Uri,
} from 'vscode';
import { isEmberCliProject, emberLikeProject } from './workspace-utils';
import { isEmberProject } from './workspace-utils';
import {
LanguageClient,
LanguageClientOptions,
Expand All @@ -30,6 +31,7 @@ import {
import { provideCodeLenses } from './lenses';
let ExtStatusBarItem: StatusBarItem;
let ExtServerDebugBarItem: StatusBarItem;
let ExtOutputChannel: OutputChannel;
export async function activate(context: ExtensionContext) {
// The server is implemented in node
const serverModule = path.join(context.extensionPath, './start-server.js');
Expand All @@ -49,10 +51,11 @@ export async function activate(context: ExtensionContext) {
},
};

if (!(await isEmberCliProject())) {
if (!(await emberLikeProject())) {
return;
}
ExtOutputChannel = window.createOutputChannel('Ember Language Server');
context.subscriptions.push(ExtOutputChannel);

if (!(await isEmberProject(ExtOutputChannel))) {
return;
}

const syncExtensions = ['js', 'ts', 'hbs', 'gts', 'gjs'];
Expand All @@ -70,7 +73,7 @@ export async function activate(context: ExtensionContext) {
'javascript',
'typescript',
],
outputChannelName: 'Ember Language Server',
outputChannel: ExtOutputChannel,
revealOutputChannelOn: RevealOutputChannelOn.Never,
initializationOptions: { editor: 'vscode' },
synchronize: {
Expand Down
Loading