Skip to content

Commit

Permalink
Bump server (#122)
Browse files Browse the repository at this point in the history
* bump server

* remove experimentalImplicitWrapComponentOptionsWithDefineComponent and experimentalImplicitWrapComponentOptionsWithVue2Extend
in favor of experimentalComponentOptionsWrapper and experimentalComponentOptionsWrapperEnable

* add volar.vueserver.textDocumentSync client glue

* add initialization options properties to sublime-packages.json

* add client volar.ignoreTriggerCharacters setting

ref #114 (comment)

* volar.vueserver.textDocumentSync order
  • Loading branch information
predragnikolic committed Sep 5, 2022
1 parent 47c6dc6 commit 200b8d6
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 83 deletions.
2 changes: 2 additions & 0 deletions LSP-volar.sublime-settings
Expand Up @@ -30,6 +30,8 @@
// Set --max-old-space-size option on server process. If you have problem on frequently
// "Request textDocument/** failed." error, try setting higher memory(MB) on it.
"volar.vueserver.maxOldSpaceSize": null,
// Defines how the host (editor) should sync document changes to the language server.
"volar.vueserver.textDocumentSync": "incremental",

// javascript inlay hint
"javascript.inlayHints.enumMemberValues.enabled": false,
Expand Down
14 changes: 14 additions & 0 deletions plugin.py
@@ -1,5 +1,6 @@
from LSP.plugin import ClientConfig
from LSP.plugin import WorkspaceFolder
from LSP.plugin.core.protocol import TextDocumentSyncKindIncremental, TextDocumentSyncKindFull, TextDocumentSyncKindNone
from LSP.plugin.core.typing import List, Optional
from lsp_utils import NpmClientHandler
import os
Expand Down Expand Up @@ -30,6 +31,7 @@ def is_allowed_to_start(
):
if not workspace_folders or not configuration:
return
configuration.init_options.set('textDocumentSync', get_text_document_sync(configuration))
configuration.init_options.set('languageFeatures', get_language_features(configuration))
configuration.init_options.set('documentFeatures', {
"selectionRange": True,
Expand Down Expand Up @@ -79,6 +81,17 @@ def get_default_attr_name_case(configuration: ClientConfig) -> str:
return 'kebabCase'


def get_text_document_sync(configuration: ClientConfig) -> int:
text_document_sync = configuration.settings.get('volar.vueserver.textDocumentSync')
if text_document_sync == 'full':
return TextDocumentSyncKindFull
if text_document_sync == 'none':
return TextDocumentSyncKindNone
return TextDocumentSyncKindIncremental

def get_ignored_trigger_characters(configuration: ClientConfig) -> str:
return configuration.settings.get('volar.ignoreTriggerCharacters') or ""

def get_language_features(configuration: ClientConfig) -> dict:
language_features = {
"references": True,
Expand All @@ -97,6 +110,7 @@ def get_language_features(configuration: ClientConfig) -> dict:
"defaultAttrNameCase": get_default_attr_name_case(configuration),
"getDocumentNameCasesRequest": False,
"getDocumentSelectionRequest": False,
"ignoreTriggerCharacters": get_ignored_trigger_characters(configuration)
},
"schemaRequestService": False,
"documentHighlight": True,
Expand Down
146 changes: 74 additions & 72 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/package.json
Expand Up @@ -2,7 +2,7 @@
"name": "sublime-volar",
"version": "0.0.0",
"dependencies": {
"@volar/vue-language-server": "^0.40.5",
"@volar/vue-language-server": "^0.40.7",
"typescript": "^4.7.4"
}
}
57 changes: 47 additions & 10 deletions sublime-package.json
Expand Up @@ -10,9 +10,32 @@
"definitions": {
"PluginConfig": {
"properties": {
"initializationOptions": {
"additionalProperties": false,
"properties": {
"typescript": {
"additionalProperties": false,
"properties": {
"serverPath": {
"type": "string",
"description": "Path to tsserverlibrary.js / tsserver.js / typescript.js."
},
"localizedPath": {
"type": "string",
"description": "Path to lib/xxx/diagnosticMessages.generated.json"
}
}
}
}
},
"settings": {
"additionalProperties": false,
"properties": {
"volar.ignoreTriggerCharacters": {
"type": "string",
"default": "",
"description": "Do not trigger the auto-complete popup on these characters."
},
"volar.autoCompleteRefs": {
"default": false,
"description": "Auto-complete Ref value with `.value`.",
Expand Down Expand Up @@ -77,6 +100,21 @@
],
"type": "string"
},
"volar.vueserver.textDocumentSync": {
"type": "string",
"default": "incremental",
"enum": [
"incremental",
"full",
"none"
],
"enumDescriptions": [
"Documents are synced by sending the full content on open. After that only incremental updates to the document are send.",
"Documents are synced by always sending the full content of the document.",
"Documents should not be synced at all."
],
"description": "Defines how the host (editor) should sync document changes to the language server. SFC incremental parser only working when config \"incremental\"."
},
"volar.vueserver.maxOldSpaceSize": {
"default": null,
"description": "Set --max-old-space-size option on server process. If you have problem on frequently \"Request textDocument/** failed.\" error, try setting higher memory(MB) on it.",
Expand Down Expand Up @@ -252,23 +290,22 @@
],
"markdownDescription": "Run app in browser or uni-app"
},
"experimentalImplicitWrapComponentOptionsWithDefineComponent": {
"enum": [
true,
false,
"onlyJs"
"experimentalComponentOptionsWrapper": {
"type": "array",
"default": [
"(await import('vue')).defineComponent(",
")"
],
"default": "onlyJs",
"markdownDescription": "Implicit wrap object literal component options export with `defineComponent()`."
"markdownDescription": "How to wrap option of `export default { ... }`? Default: `[\"(await import('vue')).default.extend(\", \")\"]` for target < 2.7, `[\"(await import('vue')).defineComponent(\", \")\"]` for target >= 2.7."
},
"experimentalImplicitWrapComponentOptionsWithVue2Extend": {
"experimentalComponentOptionsWrapperEnable": {
"enum": [
true,
false,
"onlyJs"
],
"default": false,
"markdownDescription": "Implicit wrap object literal component options export with `Vue.extend()`."
"default": "onlyJs",
"markdownDescription": "Enable `experimentalComponentOptionsWrapper`?"
},
"experimentalDowngradePropsAndEmitsToSetupReturnOnScriptSetup": {
"enum": [
Expand Down

0 comments on commit 200b8d6

Please sign in to comment.