sublimelsp / LSP-volar

Vue support for Sublime's LSP plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Reorganize Imports" action does nothing

FichteFoll opened this issue · comments

Since a couple weeks ago, using the "Reorganize Imports" code action does not do anything. In the console, I only see a 20 lines of

LSP: ignoring edit due to non-matching document version

after triggering it once.

Following are the relevant parts of the server log with paths of the current file replaced:

:: [11:07:12.599] --> LSP-volar textDocument/codeAction (50): {'context': {'diagnostics': [], 'triggerKind': 1, 'only': ['source']}, 'range': {'end': {'character': 39, 'line': 100}, 'start': {'character': 39, 'line': 100}}, 'textDocument': {'uri': 'file:///home/fichte/project/src/SomeFile.vue'}}
:: [11:07:12.599] --> LSP-eslint textDocument/codeAction (22): {'context': {'diagnostics': [], 'triggerKind': 1, 'only': ['source']}, 'range': {'end': {'character': 39, 'line': 100}, 'start': {'character': 39, 'line': 100}}, 'textDocument': {'uri': 'file:///home/fichte/project/src/SomeFile.vue'}}
:: [11:07:12.601] <<< LSP-eslint (22) (duration: 1ms): [{'command': {'command': 'eslint.applyAllFixes', 'arguments': [{'uri': 'file:///home/fichte/project/src/SomeFile.vue', 'version': 2}], 'title': 'Fix all fixable ESLint issues'}, 'title': 'Fix all fixable ESLint issues', 'kind': 'source'}]
:: [11:07:12.611] <<< LSP-volar (50) (duration: 12ms): [{'data': {'type': 'service', 'uri': 'file:///home/fichte/project/src/SomeFile.vue', 'original': {'data': {'type': 'fixAll', 'uri': 'file:///home/fichte/project/src/SomeFile.vue.ts', 'fileName': '/home/fichte/project/src/SomeFile.vue.ts', 'fixIds': ['import', 'fixMissingImport']}}, 'serviceId': 'typescript', 'version': 8}, 'title': 'Add all missing imports', 'kind': 'source', 'diagnostics': []}, {'data': {'type': 'service', 'uri': 'file:///home/fichte/project/src/SomeFile.vue', 'original': {'data': {'type': 'fixAll', 'uri': 'file:///home/fichte/project/src/SomeFile.vue.ts', 'fileName': '/home/fichte/project/src/SomeFile.vue.ts', 'fixIds': ['unusedIdentifier', 'unusedIdentifier_prefix', 'unusedIdentifier_deleteImports', 'unusedIdentifier_delete', 'unusedIdentifier_infer']}}, 'serviceId': 'typescript', 'version': 8}, 'title': 'Remove all unused code', 'kind': 'source', 'diagnostics': []}, {'data': {'type': 'service', 'uri': 'file:///home/fichte/project/src/SomeFile.vue', 'original': {'data': {'type': 'fixAll', 'uri': 'file:///home/fichte/project/src/SomeFile.vue.ts', 'fileName': '/home/fichte/project/src/SomeFile.vue.ts', 'fixIds': ['fixClassIncorrectlyImplementsInterface', 'fixAwaitInSyncFunction', 'fixUnreachableCode']}}, 'serviceId': 'typescript', 'version': 8}, 'title': 'Fix All', 'kind': 'source', 'diagnostics': []}, {'data': {'type': 'service', 'uri': 'file:///home/fichte/project/src/SomeFile.vue', 'original': {'data': {'type': 'organizeImports', 'uri': 'file:///home/fichte/project/src/SomeFile.vue.ts', 'fileName': '/home/fichte/project/src/SomeFile.vue.ts'}}, 'serviceId': 'typescript', 'version': 8}, 'title': 'Organize Imports', 'kind': 'source', 'diagnostics': []}]
:: [11:07:21.121] --> LSP-volar codeAction/resolve (51): {'data': {'type': 'service', 'uri': 'file:///home/fichte/project/src/SomeFile.vue', 'original': {'data': {'type': 'organizeImports', 'uri': 'file:///home/fichte/project/src/SomeFile.vue.ts', 'fileName': '/home/fichte/project/src/SomeFile.vue.ts'}}, 'serviceId': 'typescript', 'version': 8}, 'title': 'Organize Imports', 'kind': 'source', 'diagnostics': []}
:: [11:07:21.154] <<< LSP-volar (51) (duration: 33ms): {'data': {'type': 'organizeImports', 'uri': 'file:///home/fichte/project/src/SomeFile.vue.ts', 'fileName': '/home/fichte/project/src/SomeFile.vue.ts'}, 'title': 'Organize Imports', 'edit': {'documentChanges': [{'edits': [{'newText': "import Multiselect from '@vueform/multiselect/dist/multiselect.vue2.js';\nimport { BModal } from 'bootstrap-vue';\nimport { defineComponent } from 'vue';\nimport { mapGetters } from 'vuex';\n", 'range': {'end': {'character': 0, 'line': 98}, 'start': {'character': 0, 'line': 97}}}, {'newText': '', 'range': {'end': {'character': 0, 'line': 99}, 'start': {'character': 0, 'line': 98}}}, {'newText': '', 'range': {'end': {'character': 0, 'line': 100}, 'start': {'character': 0, 'line': 99}}}, {'newText': '', 'range': {'end': {'character': 0, 'line': 101}, 'start': {'character': 0, 'line': 100}}}, {'newText': "import LoadingIndicator from '@/components/LoadingIndicator.vue';\nimport PermissionButton from '@/components/portfolio/PermissionButton.vue';\nimport configClient, { RoomBoardMatchingAssignment } from '@/services/http/portfolio/configClient';\nimport customRatesClient, { CustomRateBrandFilter } from '@/services/http/portfolio/customRatesClient';\nimport ratingSupplierClient, { RatingAssignment } from '@/services/http/portfolio/ratingSupplierClient';\nimport roomMatchingClient from '@/services/http/portfolio/roomMatchingClient';\nimport { useBrandStore } from '@/stores/brand';\nimport { useCustomRateStore } from '@/stores/customRate';\nimport Brand from '@/types/Brand';\nimport Permission from '@/types/permission';\nimport RatingSupplier from '@/types/RatingSupplier';\nimport RoomBoardMatchingConfig from '@/types/RoomBoardMatchingConfig';\nimport { fieldIsNotNil, isNotNil } from '@/types/utils';\nimport { BvSelectOption } from '@/types/vue-bootstrap';\nimport { sortByKey } from '@/utils/helpers';\nimport RoomMatchingConfigDropdown from '@/views/masterdata/components/roommatching/rooms/RoomMatchingConfigDropdown.vue';\n", 'range': {'end': {'character': 0, 'line': 103}, 'start': {'character': 0, 'line': 102}}}, {'newText': '', 'range': {'end': {'character': 0, 'line': 104}, 'start': {'character': 0, 'line': 103}}}, {'newText': '', 'range': {'end': {'character': 0, 'line': 105}, 'start': {'character': 0, 'line': 104}}}, {'newText': '', 'range': {'end': {'character': 0, 'line': 106}, 'start': {'character': 0, 'line': 105}}}, {'newText': '', 'range': {'end': {'character': 0, 'line': 107}, 'start': {'character': 0, 'line': 106}}}, {'newText': '', 'range': {'end': {'character': 0, 'line': 108}, 'start': {'character': 0, 'line': 107}}}, {'newText': '', 'range': {'end': {'character': 0, 'line': 109}, 'start': {'character': 0, 'line': 108}}}, {'newText': '', 'range': {'end': {'character': 0, 'line': 110}, 'start': {'character': 0, 'line': 109}}}, {'newText': '', 'range': {'end': {'character': 0, 'line': 111}, 'start': {'character': 0, 'line': 110}}}, {'newText': '', 'range': {'end': {'character': 0, 'line': 112}, 'start': {'character': 0, 'line': 111}}}, {'newText': '', 'range': {'end': {'character': 0, 'line': 113}, 'start': {'character': 0, 'line': 112}}}, {'newText': '', 'range': {'end': {'character': 0, 'line': 114}, 'start': {'character': 0, 'line': 113}}}, {'newText': '', 'range': {'end': {'character': 0, 'line': 115}, 'start': {'character': 0, 'line': 114}}}, {'newText': '', 'range': {'end': {'character': 0, 'line': 116}, 'start': {'character': 0, 'line': 115}}}, {'newText': '', 'range': {'end': {'character': 0, 'line': 117}, 'start': {'character': 0, 'line': 116}}}, {'newText': '', 'range': {'end': {'character': 0, 'line': 118}, 'start': {'character': 0, 'line': 117}}}], 'textDocument': {'uri': 'file:///home/fichte/project/src/SomeFile.vue', 'version': 8}}]}, 'kind': 'source', 'diagnostics': []}

and these are the imports I want to reorganize (inside a SFC using TypeScript):

import Multiselect from '@vueform/multiselect/dist/multiselect.vue2.js';
import { defineComponent } from 'vue';
import { mapGetters } from 'vuex';
import { BModal } from 'bootstrap-vue';

import { sortByKey } from '@/utils/helpers';
import LoadingIndicator from '@/components/LoadingIndicator.vue';
import PermissionButton from '@/components/portfolio/PermissionButton.vue';
import configClient, { RoomBoardMatchingAssignment } from '@/services/http/portfolio/configClient';
import RoomMatchingConfigDropdown from '@/views/masterdata/components/roommatching/rooms/RoomMatchingConfigDropdown.vue';
import roomMatchingClient from '@/services/http/portfolio/roomMatchingClient';
import ratingSupplierClient, { RatingAssignment } from '@/services/http/portfolio/ratingSupplierClient';
import customRatesClient, { CustomRateBrandFilter } from '@/services/http/portfolio/customRatesClient';
import RoomBoardMatchingConfig from '@/types/RoomBoardMatchingConfig';
import Brand from '@/types/Brand';
import RatingSupplier from '@/types/RatingSupplier';
import { fieldIsNotNil, isNotNil } from '@/types/utils';
import { BvSelectOption } from '@/types/vue-bootstrap';
import { useBrandStore } from '@/stores/brand';
import { useCustomRateStore } from '@/stores/customRate';
import Permission from '@/types/permission';

Cross-linking the upstream-upstream issue: volarjs/services#50