coc-tinymist 0.1.5 → 0.1.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +27 -7
- package/package.json +6 -1
package/lib/index.js
CHANGED
|
@@ -8183,6 +8183,12 @@ var TINYMIST_SETTING_DESCRIPTORS = [
|
|
|
8183
8183
|
scope: "local",
|
|
8184
8184
|
description: "Enable Coc-side inlay hint fallback."
|
|
8185
8185
|
},
|
|
8186
|
+
{
|
|
8187
|
+
key: "completion.suppressBareHash",
|
|
8188
|
+
defaultValue: true,
|
|
8189
|
+
scope: "local",
|
|
8190
|
+
description: "Suppress Tinymist completions at a standalone bare #."
|
|
8191
|
+
},
|
|
8186
8192
|
{
|
|
8187
8193
|
key: "fallback.maxFileBytes",
|
|
8188
8194
|
defaultValue: 524288,
|
|
@@ -8653,6 +8659,9 @@ var Config = class {
|
|
|
8653
8659
|
get markdownSupportHtml() {
|
|
8654
8660
|
return this.cfg.get("markdown.supportHtml", false);
|
|
8655
8661
|
}
|
|
8662
|
+
get completionSuppressBareHash() {
|
|
8663
|
+
return this.cfg.get("completion.suppressBareHash", true);
|
|
8664
|
+
}
|
|
8656
8665
|
get exportOnSave() {
|
|
8657
8666
|
return readExportKinds(this.cfg.get("exportOnSave", []));
|
|
8658
8667
|
}
|
|
@@ -9971,22 +9980,21 @@ var BinaryResolver = class {
|
|
|
9971
9980
|
var import_coc17 = require("coc.nvim");
|
|
9972
9981
|
|
|
9973
9982
|
// src/features/completion.ts
|
|
9974
|
-
function filterTinymistCompletions(document2, position,
|
|
9983
|
+
function filterTinymistCompletions(document2, position, result, options = {}) {
|
|
9975
9984
|
if (!result) {
|
|
9976
9985
|
return result;
|
|
9977
9986
|
}
|
|
9978
9987
|
const linePrefix = lineTextBeforePosition(document2, position);
|
|
9979
|
-
if (shouldSuppressBareHashCompletion(linePrefix
|
|
9980
|
-
return
|
|
9988
|
+
if ((options.suppressBareHash ?? true) && shouldSuppressBareHashCompletion(linePrefix)) {
|
|
9989
|
+
return emptyCompletionResult(result);
|
|
9981
9990
|
}
|
|
9982
9991
|
if (!isCitationLabelCompletionContext(linePrefix)) {
|
|
9983
9992
|
return result;
|
|
9984
9993
|
}
|
|
9985
9994
|
return mapCompletionItems(result, dedupeCitationCompletions);
|
|
9986
9995
|
}
|
|
9987
|
-
function shouldSuppressBareHashCompletion(linePrefix
|
|
9988
|
-
|
|
9989
|
-
return Boolean(isTriggerCompletion && /(^|[^A-Za-z0-9_])#$/.test(linePrefix));
|
|
9996
|
+
function shouldSuppressBareHashCompletion(linePrefix) {
|
|
9997
|
+
return /(^|[^A-Za-z0-9_])#$/.test(linePrefix);
|
|
9990
9998
|
}
|
|
9991
9999
|
function isCitationLabelCompletionContext(linePrefix) {
|
|
9992
10000
|
return /#cite\s*\([^)\n]*<[^>\s,;)\]]*$/.test(linePrefix);
|
|
@@ -10031,6 +10039,16 @@ function mapCompletionItems(result, map) {
|
|
|
10031
10039
|
items: map(result.items)
|
|
10032
10040
|
};
|
|
10033
10041
|
}
|
|
10042
|
+
function emptyCompletionResult(result) {
|
|
10043
|
+
if (Array.isArray(result)) {
|
|
10044
|
+
return [];
|
|
10045
|
+
}
|
|
10046
|
+
return {
|
|
10047
|
+
...result,
|
|
10048
|
+
isIncomplete: false,
|
|
10049
|
+
items: []
|
|
10050
|
+
};
|
|
10051
|
+
}
|
|
10034
10052
|
function citationCompletionKey(item) {
|
|
10035
10053
|
return normalizeCitationKey(completionInsertText(item)) ?? normalizeCitationKey(item.filterText) ?? normalizeCitationKey(item.label);
|
|
10036
10054
|
}
|
|
@@ -10192,7 +10210,9 @@ function createClient(bin, config2) {
|
|
|
10192
10210
|
},
|
|
10193
10211
|
async provideCompletionItem(document2, position, completionContext, token, next) {
|
|
10194
10212
|
const result = await next(document2, position, completionContext, token);
|
|
10195
|
-
return filterTinymistCompletions(document2, position,
|
|
10213
|
+
return filterTinymistCompletions(document2, position, result, {
|
|
10214
|
+
suppressBareHash: config2.completionSuppressBareHash
|
|
10215
|
+
});
|
|
10196
10216
|
},
|
|
10197
10217
|
async provideCodeActions(document2, range, actionContext, token, next) {
|
|
10198
10218
|
const params = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coc-tinymist",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.75",
|
|
4
4
|
"description": "Typst language support for coc.nvim powered by Tinymist",
|
|
5
5
|
"author": "SeniorMars <cjh16@rice.edu>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -504,6 +504,11 @@
|
|
|
504
504
|
"default": false,
|
|
505
505
|
"markdownDescription": "Enable coc-tinymist's opt-in inlay hint fallback for simple local Typst function parameter names. This provider is additive to Tinymist's inlay hints."
|
|
506
506
|
},
|
|
507
|
+
"tinymist.completion.suppressBareHash": {
|
|
508
|
+
"type": "boolean",
|
|
509
|
+
"default": true,
|
|
510
|
+
"markdownDescription": "Suppress Tinymist completions at a standalone bare `#`. Set to `false` to show Tinymist's full bare-`#` completion list."
|
|
511
|
+
},
|
|
507
512
|
"tinymist.fallback.maxFileBytes": {
|
|
508
513
|
"type": "number",
|
|
509
514
|
"default": 524288,
|