Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template completionItem's sortText value may be undefined. #1118

Closed
jadestrong opened this issue Mar 28, 2022 · 3 comments
Closed

Template completionItem's sortText value may be undefined. #1118

jadestrong opened this issue Mar 28, 2022 · 3 comments
Labels

Comments

@jadestrong
Copy link

https://github.com/johnsoncodehk/volar/blob/46bb18087edf9dc4e9a8cb8cbf8ada126748f0de/packages/vue-language-service/src/vuePlugins/vueTemplateLanguage.ts#L664

        {
            "label": ":class",
            "kind": 10,
            "textEdit": {
                "range": {
                    "start": {
                        "line": 1,
                        "character": 14
                    },
                    "end": {
                        "line": 1,
                        "character": 15
                    }
                },
                "newText": ":class=\"$1\""
            },
            "insertTextFormat": 2,
            "sortText": "\u0000undefined",
            "data": {
                "uri": "file:///Users/jadestrong/Documents/JadeStrong/volar-starter/src/App.vue",
                "originalItem": {
                    "label": ":class",
                    "kind": 10,
                    "textEdit": {
                        "range": {
                            "start": {
                                "line": 1,
                                "character": 14
                            },
                            "end": {
                                "line": 1,
                                "character": 15
                            }
                        },
                        "newText": ":class=\"$1\""
                    },
                    "insertTextFormat": 2,
                    "sortText": "\u0000undefined",
                    "data": {
                        "mode": "html",
                        "tsItem": {
                            "name": "class",
                            "kind": "property",
                            "kindModifiers": "declare,optional",
                            "sortText": "11"
                        }
                    }
                },
                "pluginId": 2,
                "sourceMap": {
                    "lsType": "nonTs",
                    "embeddedDocumentUri": "file:///Users/jadestrong/Documents/JadeStrong/volar-starter/src/App.vue.html"
                }
            }
        },
        {
            "label": "v-bind:class",
            "kind": 10,
            "textEdit": {
                "range": {
                    "start": {
                        "line": 1,
                        "character": 14
                    },
                    "end": {
                        "line": 1,
                        "character": 15
                    }
                },
                "newText": "v-bind:class=\"$1\""
            },
            "insertTextFormat": 2,
            "sortText": "\u0000undefined",
            "data": {
                "uri": "file:///Users/jadestrong/Documents/JadeStrong/volar-starter/src/App.vue",
                "originalItem": {
                    "label": "v-bind:class",
                    "kind": 10,
                    "textEdit": {
                        "range": {
                            "start": {
                                "line": 1,
                                "character": 14
                            },
                            "end": {
                                "line": 1,
                                "character": 15
                            }
                        },
                        "newText": "v-bind:class=\"$1\""
                    },
                    "insertTextFormat": 2,
                    "sortText": "\u0000undefined",
                    "data": {
                        "mode": "html",
                        "tsItem": {
                            "name": "class",
                            "kind": "property",
                            "kindModifiers": "declare,optional",
                            "sortText": "11"
                        }
                    }
                },
                "pluginId": 2,
                "sourceMap": {
                    "lsType": "nonTs",
                    "embeddedDocumentUri": "file:///Users/jadestrong/Documents/JadeStrong/volar-starter/src/App.vue.html"
                }
            }
        },

image

image

The above problems occur when attribute completion is performed in the template .

@jadestrong
Copy link
Author

emacs-lsp/lsp-mode#2681

@johnsoncodehk johnsoncodehk added the bug Something isn't working label Apr 3, 2022
@jadestrong
Copy link
Author

In the completion result of JS, the sortText is a numeric string, and in template, it is a \u0000 + label

image
\u0000 in JSON data are not supported in Emacs . Can \u0000 be removed?

@johnsoncodehk
Copy link
Member

You can try emacs-lsp/lsp-mode#2681 (comment)

@johnsoncodehk johnsoncodehk added upstream and removed bug Something isn't working labels Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants