summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/lsp_tests.rs63
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs
index e05e182cb..d0df5e6e8 100644
--- a/tests/integration/lsp_tests.rs
+++ b/tests/integration/lsp_tests.rs
@@ -8607,6 +8607,69 @@ fn lsp_completions_node_specifier() {
}
#[test]
+fn lsp_completions_node_specifier_node_modules_dir() {
+ let context = TestContextBuilder::new()
+ .use_http_server()
+ .use_temp_cwd()
+ .build();
+ let temp_dir = context.temp_dir();
+ temp_dir.write(
+ temp_dir.path().join("deno.json"),
+ json!({
+ "nodeModulesDir": true,
+ })
+ .to_string(),
+ );
+ let mut client = context.new_lsp_command().build();
+ client.initialize_default();
+ client.did_open(json!({
+ "textDocument": {
+ "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "languageId": "typescript",
+ "version": 1,
+ "text": "import fs from \"node:fs\";\n",
+ },
+ }));
+ client.write_request(
+ "workspace/executeCommand",
+ json!({
+ "command": "deno.cache",
+ "arguments": [[], temp_dir.uri().join("file.ts").unwrap()],
+ }),
+ );
+ client.write_notification(
+ "textDocument/didChange",
+ json!({
+ "textDocument": {
+ "uri": temp_dir.uri().join("file.ts").unwrap(),
+ "version": 2,
+ },
+ "contentChanges": [
+ {
+ "range": {
+ "start": { "line": 1, "character": 0 },
+ "end": { "line": 1, "character": 0 },
+ },
+ "text": "fs.",
+ },
+ ],
+ }),
+ );
+ let list = client.get_completion_list(
+ temp_dir.uri().join("file.ts").unwrap(),
+ (1, 3),
+ json!({
+ "triggerKind": 2,
+ "triggerCharacter": ".",
+ }),
+ );
+ assert!(!list.is_incomplete);
+ assert!(list.items.iter().any(|i| i.label == "writeFile"));
+ assert!(list.items.iter().any(|i| i.label == "writeFileSync"));
+ client.shutdown();
+}
+
+#[test]
fn lsp_completions_registry() {
let context = TestContextBuilder::new()
.use_http_server()