-
Notifications
You must be signed in to change notification settings - Fork 182
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
lsp_code_actions_on_save
do not work intermittently
#2482
Comments
lsp_code_actions_on_save
do not work intermittently
Also noticed something else. If I have
useCallback, reactLogo and viteLogo are not needed. I experience the same problem of save-after-typing, even when If I use With all of these issues, order of the actions does not seem to matter. |
I'm not sure if something changed, but I've discovered that Logs:
|
By the way, the workaround I'm using is
|
That looks like a missed bug to me still from the Python 3.8 update. LSP tries to send the enum value object for the triggerKind instead of just the plain value. I guess there is a corresponding error message in the console that it's not JSON-serializable? |
I enabled
If I can help debug this in some way, please let me know and I'd be glad to help. |
It is a bug. We trigger multiple Lines 261 to 265 in cd7cb68
So when the edits for the first one is applied, Line 56 in cd7cb68
Request
{
"context": {
"diagnostics": [
{
"code": 2304,
"message": "Cannot find name 'useState'.",
"range": {"end": {"character": 20, "line": 18 }, "start": {"character": 12, "line": 18 } },
"severity": 1,
"source": "typescript",
"tags": []
},
{
"code": 6133,
"message": "'d' is declared but its value is never read.",
"range": {"end": {"character": 9, "line": 18 }, "start": {"character": 8, "line": 18 } },
"severity": 4,
"source": "typescript",
"tags": [1]
}
],
"only": [
"source.addMissingImports.ts",
"source.organizeImports.ts"
],
"triggerKind": 2
},
"range": {"end": {"character": 0, "line": 113 }, "start": {"character": 0, "line": 0 } },
"textDocument": {
"uri": "file:///Users/predrag/Documents/work/pravoslavnaknjizara/appAdmin/src/pages/OrdersPage/OrdersPage.tsx"
}
} Response[
{
"edit": {
"documentChanges": [
{
"edits": [
{
"newText": "import { DataNotFound } from \"@/components/NotDataFound/NotDataFound\"\nimport { SomethingBadHappen } from \"@/components/SomethingBadHappen/SomethingBadHappen\"\nimport { TopBar } from \"@/components/TopBar/TopBar\"\nimport { fets } from \"@/http\"\nimport { orderStatusToLabel } from \"@/utils/orderStatusLabels\"\nimport { useScrollToTop } from \"@/utils/useScrollToTop\"\nimport { Input, Pagination, ScrollShadow, Tab, Tabs } from \"@nextui-org/react\"\nimport { OrderStatus } from \"@shared/utils/applicationWideConstants\"\nimport { useDebounce } from \"@shared/utils/hooks/useDebounce\"\nimport { useNoInitialEffect } from \"@shared/utils/hooks/useNoInitialEffect\"\nimport { usePagination } from \"@shared/utils/hooks/usePagination\"\nimport { useQueryParam } from \"@shared/utils/hooks/useQueryParams\"\nimport { keepPreviousData, useQuery } from \"@tanstack/react-query\"\nimport { AnimatePresence, motion } from \"framer-motion\"\nimport { Search } from \"lucide-react\"\nimport { OrderItem } from \"./components/OrderItem\"\n",
"range": {
"end": {
"character": 0,
"line": 1
},
"start": {
"character": 0,
"line": 0
}
}
},
{
"newText": "",
"range": {"end": {"character": 0, "line": 2 }, "start": {"character": 0, "line": 1 } } },
{
"newText": "",
"range": {"end": {"character": 0, "line": 3 }, "start": {"character": 0, "line": 2 }
}
},
{
"newText": "",
"range": {"end": {"character": 0, "line": 4 }, "start": {"character": 0, "line": 3 } }
},
{
"newText": "",
"range": {"end": {"character": 0, "line": 5 }, "start": {"character": 0, "line": 4 }
}
},
{
"newText": "",
"range": {"end": {"character": 0, "line": 6 }, "start": {"character": 0, "line": 5 }
}
},
{
"newText": "",
"range": {"end": {"character": 0, "line": 7 }, "start": {"character": 0, "line": 6 } }
},
{
"newText": "",
"range": {"end": {"character": 0, "line": 8 }, "start": {"character": 0, "line": 7 } }
},
{
"newText": "",
"range": {"end": {"character": 0, "line": 9 }, "start": {"character": 0, "line": 8 } }
},
{
"newText": "",
"range": {"end": {"character": 0, "line": 10 }, "start": {"character": 0, "line": 9 } }
},
{
"newText": "",
"range": {"end": {"character": 0, "line": 11 }, "start": {"character": 0, "line": 10 } }
},
{
"newText": "",
"range": {"end": {"character": 0, "line": 12 }, "start": {"character": 0, "line": 11 } }
},
{
"newText": "",
"range": {"end": {"character": 0, "line": 13 }, "start": {"character": 0, "line": 12 } }
},
{
"newText": "",
"range": {"end": {"character": 0, "line": 14 }, "start": {"character": 0, "line": 13 } }
},
{
"newText": "",
"range": {"end": {"character": 0, "line": 15 }, "start": {"character": 0, "line": 14 } }
},
{
"newText": "",
"range": {"end": {"character": 0, "line": 16 }, "start": {"character": 0, "line": 15 } }
}
],
"textDocument": {
"uri": "file:///Users/predrag/Documents/work/pravoslavnaknjizara/appAdmin/src/pages/OrdersPage/OrdersPage.tsx",
"version": 192
}
}
]
},
"kind": "source.organizeImports.ts",
"title": "Organize Imports"
},
{
"edit": {
"documentChanges": [
{
"edits": [
{
"newText": "import { useState } from \"react\"\n",
"range": {"end": {"character": 0, "line": 16 }, "start": {"character": 0, "line": 16 } }
}
],
"textDocument": {
"uri": "file:///Users/predrag/Documents/work/pravoslavnaknjizara/appAdmin/src/pages/OrdersPage/OrdersPage.tsx",
"version": 192
}
}
]
},
"kind": "source.addMissingImports.ts",
"title": "Add all missing imports"
}
] |
I believe I said somewhere that vscode only sends at most one code action in the |
closing as duplicate of #2421 |
Describe the bug
I'm using LSP-typescript in sublimetext4 on Linux.
With the following LSP configuration, the
addMissingImports
action doesn't work, intermittently.I think it's possibly an overload of the typescript server. When I use only
source.addMissingImports.ts
without organize or fix, it works more often.This is a simple example, it's a very basic react app created with vite, in
App.tsx
If I edit the file at all, eg insert a new line, am typing a comment, or anything, and save immediately after my last keystroke: the import is not added back.
But if I finish typing and wait about 1 second, and then save, the import is added back. So it seems like typescript is still "processing" my new additions and therefore doesn't respect the action.
Expected behavior
Import should always be added regardless of ongoing "processing" by the typescript server.
Logs
This log is me adding an "f" to the end of a comment and saving immediately, when it didn't work.
Environment (please complete the following information):
Possibly related to these issues:
#2421
microsoft/vscode#164876
The text was updated successfully, but these errors were encountered: