Skip to content

Commit

Permalink
fix: revert VLS version to 0.5.7 and fix VLS version detection
Browse files Browse the repository at this point in the history
  • Loading branch information
tommasongr committed May 1, 2021
1 parent 768274b commit aef11b7
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 2,581 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Version 4.1

### FIX

- Reverted VLS version to 0.5.7 for unknown breaking issues

## Version 4.0

### NEW
Expand Down
2 changes: 1 addition & 1 deletion Vue.novaextension/extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Vue",
"organization": "Tommaso Negri",
"description": "Vue syntax and Vue Language Server for Nova editor.",
"version": "4.0",
"version": "4.1",
"categories": [
"languages",
"clips",
Expand Down
2,462 changes: 11 additions & 2,451 deletions Vue.novaextension/npm-shrinkwrap.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Vue.novaextension/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Vue.novaextension",
"version": "4.0.0",
"version": "4.1.0",
"dependencies": {
"vls": "^0.7.2"
"vls": "^0.5.7"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nova-vue",
"version": "4.0.0",
"version": "4.1.0",
"description": "Vue support for Nova editor.",
"main": "src/Scripts/main.js",
"scripts": {
Expand Down
121 changes: 0 additions & 121 deletions src/Scripts/VueLanguageServer.js

This file was deleted.

5 changes: 4 additions & 1 deletion src/Scripts/helpers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { dependencyManagement } from 'nova-extension-utils'

import isStatusNotificationsEnabled from './settings/extension/statusNotifications'

/**
Expand Down Expand Up @@ -41,7 +43,8 @@ export function showNotification(
export async function getVlsVersion() {
return new Promise((resolve, reject) => {
const process = new Process('/usr/bin/env', {
args: ['npm', 'view', 'vls', 'version'],
cwd: dependencyManagement.getDependencyDirectory(),
args: ['node', '-p', "require('vls/package.json').version"],
stdio: ['ignore', 'pipe', 'ignore'],
})
let str = ''
Expand Down
70 changes: 66 additions & 4 deletions src/Scripts/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
import { InformationView } from './informationView'
import { showNotification, getVlsVersion } from './helpers'
import { dependencyManagement } from 'nova-extension-utils'
import { VueLanguageServer } from './VueLanguageServer'

// Settings
import isCompletionAutoImportEnabled from './settings/completionAutoImport'
import isCompletionTagCasingEnabled from './settings/completionTagCasing'
import isLanguageFeaturesCodeActionsEnabled from './settings/languageFeaturesCodeActions'
import isLanguageFeaturesUpdateImportOnFileMoveEnabled from './settings/languageFeaturesUpdateImportOnFileMove'
import isValidationInterpolationEnabled from './settings/validationInterpolation'
import isValidationScriptEnabled from './settings/validationScript'
import isValidationStyleEnabled from './settings/validationStyle'
import isValidationTemplateEnabled from './settings/validationTemplate'
import isValidationTemplatePropsEnabled from './settings/validationTemplateProps'
import isExperimentalTemplateInterpolationServiceEnabled from './settings/experimentalTemplateInterpolationService'
import isMiscUseWorkspaceDependenciesEnabled from './settings/miscUseWorkspaceDependencies'
import isMiscIgnoreProjectWarningEnabled from './settings/miscIgnoreProjectWarning'
import isDevLogLevelEnabled from './settings/devLogLevel'

// Register a Nova command for starting Vue Language Server
nova.commands.register('tommasonegri.vue.commands.startServer', function () {
Expand Down Expand Up @@ -181,11 +195,57 @@ async function asyncActivate() {
}

// Instantiate the Vue Language Server
langserver = new VueLanguageServer()
var serverOptions = {
path: vlsPath,
}
var clientOptions = {
// The set of document syntaxes for which the server is valid
syntaxes: ['vue'],
initializationOptions: {
config: {
vetur: {
completion: {
autoImport: isCompletionAutoImportEnabled(),
tagCasing: isCompletionTagCasingEnabled(),
},
languageFeatures: {
codeActions: isLanguageFeaturesCodeActionsEnabled(),
updateImportOnFileMove: isLanguageFeaturesUpdateImportOnFileMoveEnabled(),
},
// Disabled by default for preventing xxx errors to show up
validation: {
interpolation: isValidationInterpolationEnabled(),
script: isValidationScriptEnabled(),
style: isValidationStyleEnabled(),
template: isValidationTemplateEnabled(),
templateProps: isValidationTemplatePropsEnabled(),
},
experimental: {
templateInterpolationService: isExperimentalTemplateInterpolationServiceEnabled(),
},
dev: {
logLevel: isDevLogLevelEnabled(),
},
format: {
enable: false,
},
ignoreProjectWarning: isMiscIgnoreProjectWarningEnabled(),
useWorkspaceDependencies: isMiscUseWorkspaceDependenciesEnabled(),
},
},
},
}

langserver = new LanguageClient(
'tommasonegri.vue',
'Vue Language Server',
serverOptions,
clientOptions
)

// Add an event listener for when Vue Language Server stops
compositeDisposable.add(
langserver.languageClient.onDidStop((err) => {
langserver.onDidStop((err) => {
informationView.status = 'Stopped'

// Display an error message and a restart button if the server stopped unexpectedly
Expand All @@ -212,6 +272,8 @@ async function asyncActivate() {
})
)

langserver.start()

// Retrieve the running VLS version to display in the Information Sidebar
getVlsVersion()
.then((version) => {
Expand Down Expand Up @@ -244,7 +306,7 @@ export function activate() {
export function deactivate() {
// Clean up state before the extension is deactivated
if (langserver) {
langserver.deactivate()
langserver.stop()
langserver = null

// Used for the when clause of the start/stop server command
Expand Down

0 comments on commit aef11b7

Please sign in to comment.