1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 23:34:47 -05:00

refactor: share test harness for lsp between bench and integration (#10659)

This commit is contained in:
Kitson Kelly 2021-05-18 06:45:13 +10:00 committed by Bert Belder
parent 9ad52a28e5
commit 96abb27e73
No known key found for this signature in database
GPG key ID: 7A77887B2E2ED461
107 changed files with 3296 additions and 3879 deletions

2
Cargo.lock generated
View file

@ -3471,6 +3471,7 @@ dependencies = [
name = "test_util" name = "test_util"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"anyhow",
"async-stream", "async-stream",
"bytes", "bytes",
"futures", "futures",
@ -3480,6 +3481,7 @@ dependencies = [
"pty", "pty",
"regex", "regex",
"serde", "serde",
"serde_json",
"tempfile", "tempfile",
"tokio", "tokio",
"tokio-rustls", "tokio-rustls",

View file

@ -1,37 +1,21 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use deno_core::error::generic_error;
use deno_core::error::AnyError; use deno_core::error::AnyError;
use deno_core::serde::de;
use deno_core::serde::Deserialize; use deno_core::serde::Deserialize;
use deno_core::serde::Serialize;
use deno_core::serde_json; use deno_core::serde_json;
use deno_core::serde_json::json; use deno_core::serde_json::json;
use deno_core::serde_json::Value; use deno_core::serde_json::Value;
use lazy_static::lazy_static;
use regex::Regex;
use std::collections::HashMap; use std::collections::HashMap;
use std::io::BufRead;
use std::io::Read;
use std::io::Write;
use std::path::Path; use std::path::Path;
use std::process::ChildStdin;
use std::process::ChildStdout;
use std::process::Command;
use std::process::Stdio;
use std::time::Duration; use std::time::Duration;
use std::time::Instant; use test_util::lsp::LspClient;
use test_util::lsp::LspResponseError;
static FIXTURE_DB_TS: &str = include_str!("fixtures/db.ts"); static FIXTURE_DB_TS: &str = include_str!("fixtures/db.ts");
static FIXTURE_DB_MESSAGES: &[u8] = include_bytes!("fixtures/db_messages.json"); static FIXTURE_DB_MESSAGES: &[u8] = include_bytes!("fixtures/db_messages.json");
static FIXTURE_INIT_JSON: &[u8] = static FIXTURE_INIT_JSON: &[u8] =
include_bytes!("fixtures/initialize_params.json"); include_bytes!("fixtures/initialize_params.json");
lazy_static! {
static ref CONTENT_TYPE_REG: Regex =
Regex::new(r"(?i)^content-length:\s+(\d+)").unwrap();
}
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
enum FixtureType { enum FixtureType {
#[serde(rename = "action")] #[serde(rename = "action")]
@ -53,224 +37,6 @@ struct FixtureMessage {
params: Value, params: Value,
} }
#[derive(Debug, Deserialize, Serialize)]
struct LspResponseError {
code: i32,
message: String,
data: Option<Value>,
}
#[derive(Debug)]
enum LspMessage {
Notification(String, Option<Value>),
Request(u64, String, Option<Value>),
Response(u64, Option<Value>, Option<LspResponseError>),
}
impl<'a> From<&'a [u8]> for LspMessage {
fn from(s: &'a [u8]) -> Self {
let value: Value = serde_json::from_slice(s).unwrap();
let obj = value.as_object().unwrap();
if obj.contains_key("id") && obj.contains_key("method") {
let id = obj.get("id").unwrap().as_u64().unwrap();
let method = obj.get("method").unwrap().as_str().unwrap().to_string();
Self::Request(id, method, obj.get("params").cloned())
} else if obj.contains_key("id") {
let id = obj.get("id").unwrap().as_u64().unwrap();
let maybe_error: Option<LspResponseError> = obj
.get("error")
.map(|v| serde_json::from_value(v.clone()).unwrap());
Self::Response(id, obj.get("result").cloned(), maybe_error)
} else {
assert!(obj.contains_key("method"));
let method = obj.get("method").unwrap().as_str().unwrap().to_string();
Self::Notification(method, obj.get("params").cloned())
}
}
}
struct LspClient {
reader: std::io::BufReader<ChildStdout>,
child: std::process::Child,
request_id: u64,
start: Instant,
writer: std::io::BufWriter<ChildStdin>,
}
fn read_message<R>(reader: &mut R) -> Result<Vec<u8>, AnyError>
where
R: Read + BufRead,
{
let mut content_length = 0_usize;
loop {
let mut buf = String::new();
reader.read_line(&mut buf)?;
if let Some(captures) = CONTENT_TYPE_REG.captures(&buf) {
let content_length_match = captures
.get(1)
.ok_or_else(|| generic_error("missing capture"))?;
content_length = content_length_match.as_str().parse::<usize>()?;
}
if &buf == "\r\n" {
break;
}
}
let mut msg_buf = vec![0_u8; content_length];
reader.read_exact(&mut msg_buf)?;
Ok(msg_buf)
}
impl Drop for LspClient {
fn drop(&mut self) {
match self.child.try_wait() {
Ok(None) => {
self.child.kill().unwrap();
let _ = self.child.wait();
}
Ok(Some(status)) => panic!("deno lsp exited unexpectedly {}", status),
Err(e) => panic!("pebble error: {}", e),
}
}
}
impl LspClient {
fn new(deno_exe: &Path) -> Result<Self, AnyError> {
let mut child = Command::new(deno_exe)
.arg("lsp")
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::null())
.spawn()?;
let stdout = child.stdout.take().unwrap();
let reader = std::io::BufReader::new(stdout);
let stdin = child.stdin.take().unwrap();
let writer = std::io::BufWriter::new(stdin);
Ok(Self {
child,
reader,
request_id: 1,
start: Instant::now(),
writer,
})
}
fn duration(&self) -> Duration {
self.start.elapsed()
}
fn read(&mut self) -> Result<LspMessage, AnyError> {
let msg_buf = read_message(&mut self.reader)?;
let msg = LspMessage::from(msg_buf.as_slice());
Ok(msg)
}
fn read_notification<R>(&mut self) -> Result<(String, Option<R>), AnyError>
where
R: de::DeserializeOwned,
{
loop {
if let LspMessage::Notification(method, maybe_params) = self.read()? {
if let Some(p) = maybe_params {
let params = serde_json::from_value(p)?;
return Ok((method, Some(params)));
} else {
return Ok((method, None));
}
}
}
}
#[allow(unused)]
fn read_request<R>(&mut self) -> Result<(u64, String, Option<R>), AnyError>
where
R: de::DeserializeOwned,
{
loop {
if let LspMessage::Request(id, method, maybe_params) = self.read()? {
if let Some(p) = maybe_params {
let params = serde_json::from_value(p)?;
return Ok((id, method, Some(params)));
} else {
return Ok((id, method, None));
}
}
}
}
fn write(&mut self, value: Value) -> Result<(), AnyError> {
let value_str = value.to_string();
let msg = format!(
"Content-Length: {}\r\n\r\n{}",
value_str.as_bytes().len(),
value_str
);
self.writer.write_all(msg.as_bytes())?;
self.writer.flush()?;
Ok(())
}
fn write_request<S, V>(
&mut self,
method: S,
params: V,
) -> Result<(Option<Value>, Option<LspResponseError>), AnyError>
where
S: AsRef<str>,
V: Serialize,
{
let value = json!({
"jsonrpc": "2.0",
"id": self.request_id,
"method": method.as_ref(),
"params": params,
});
self.write(value)?;
loop {
if let LspMessage::Response(id, result, error) = self.read()? {
assert_eq!(id, self.request_id);
self.request_id += 1;
return Ok((result, error));
}
}
}
#[allow(unused)]
fn write_response<V>(&mut self, id: u64, result: V) -> Result<(), AnyError>
where
V: Serialize,
{
let value = json!({
"jsonrpc": "2.0",
"id": id,
"result": result
});
self.write(value)
}
fn write_notification<S, V>(
&mut self,
method: S,
params: V,
) -> Result<(), AnyError>
where
S: AsRef<str>,
V: Serialize,
{
let value = json!({
"jsonrpc": "2.0",
"method": method.as_ref(),
"params": params,
});
self.write(value)?;
Ok(())
}
}
/// A benchmark that opens a 8000+ line TypeScript document, adds a function to /// A benchmark that opens a 8000+ line TypeScript document, adds a function to
/// the end of the document and does a level of hovering and gets quick fix /// the end of the document and does a level of hovering and gets quick fix
/// code actions. /// code actions.
@ -320,19 +86,29 @@ fn bench_big_file_edits(deno_exe: &Path) -> Result<Duration, AnyError> {
for msg in messages { for msg in messages {
match msg.fixture_type { match msg.fixture_type {
FixtureType::Action => { FixtureType::Action => {
client.write_request("textDocument/codeAction", msg.params)?; client.write_request::<_, _, Value>(
"textDocument/codeAction",
msg.params,
)?;
} }
FixtureType::Change => { FixtureType::Change => {
client.write_notification("textDocument/didChange", msg.params)?; client.write_notification("textDocument/didChange", msg.params)?;
} }
FixtureType::Completion => { FixtureType::Completion => {
client.write_request("textDocument/completion", msg.params)?; client.write_request::<_, _, Value>(
"textDocument/completion",
msg.params,
)?;
} }
FixtureType::Highlight => { FixtureType::Highlight => {
client.write_request("textDocument/documentHighlight", msg.params)?; client.write_request::<_, _, Value>(
"textDocument/documentHighlight",
msg.params,
)?;
} }
FixtureType::Hover => { FixtureType::Hover => {
client.write_request("textDocument/hover", msg.params)?; client
.write_request::<_, _, Value>("textDocument/hover", msg.params)?;
} }
} }
} }
@ -427,13 +203,3 @@ pub(crate) fn benchmarks(
Ok(exec_times) Ok(exec_times)
} }
#[cfg(test)]
mod tests {
#[test]
fn test_read_message() {
let msg = b"content-length: 11\r\n\r\nhello world";
let reader = std::io::Cursor::new(msg);
assert_eq!(read_message(reader).unwrap(), b"hello world");
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,10 +1,18 @@
{ {
"jsonrpc": "2.0", "textDocument": {
"id": 4, "uri": "file:///a/file.ts"
"method": "codeAction/resolve", },
"params": { "range": {
"title": "Add all missing 'async' modifiers", "start": {
"kind": "quickfix", "line": 1,
"character": 2
},
"end": {
"line": 1,
"character": 7
}
},
"context": {
"diagnostics": [ "diagnostics": [
{ {
"range": { "range": {
@ -24,9 +32,8 @@
"relatedInformation": [] "relatedInformation": []
} }
], ],
"data": { "only": [
"specifier": "file:///a/file.ts", "quickfix"
"fixId": "fixAwaitInSyncFunction" ]
}
} }
} }

View file

@ -0,0 +1,41 @@
{
"textDocument": {
"uri": "file:///a/file.ts"
},
"range": {
"start": {
"line": 0,
"character": 19
},
"end": {
"line": 0,
"character": 49
}
},
"context": {
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 19
},
"end": {
"line": 0,
"character": 49
}
},
"severity": 1,
"code": "no-cache",
"source": "deno",
"message": "Unable to load the remote module: \"https://deno.land/x/a/mod.ts\".",
"data": {
"specifier": "https://deno.land/x/a/mod.ts"
}
}
],
"only": [
"quickfix"
]
}
}

View file

@ -1,44 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/codeAction",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
},
"range": {
"start": {
"line": 1,
"character": 2
},
"end": {
"line": 1,
"character": 7
}
},
"context": {
"diagnostics": [
{
"range": {
"start": {
"line": 1,
"character": 2
},
"end": {
"line": 1,
"character": 7
}
},
"severity": 1,
"code": 1308,
"source": "deno-ts",
"message": "'await' expressions are only allowed within async functions and at the top levels of modules.",
"relatedInformation": []
}
],
"only": [
"quickfix"
]
}
}
}

View file

@ -1,46 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/codeAction",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
},
"range": {
"start": {
"line": 0,
"character": 19
},
"end": {
"line": 0,
"character": 49
}
},
"context": {
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 19
},
"end": {
"line": 0,
"character": 49
}
},
"severity": 1,
"code": "no-cache",
"source": "deno",
"message": "Unable to load the remote module: \"https://deno.land/x/a/mod.ts\".",
"data": {
"specifier": "https://deno.land/x/a/mod.ts"
}
}
],
"only": [
"quickfix"
]
}
}
}

View file

@ -0,0 +1,27 @@
{
"title": "Add all missing 'async' modifiers",
"kind": "quickfix",
"diagnostics": [
{
"range": {
"start": {
"line": 1,
"character": 2
},
"end": {
"line": 1,
"character": 7
}
},
"severity": 1,
"code": 1308,
"source": "deno-ts",
"message": "'await' expressions are only allowed within async functions and at the top levels of modules.",
"relatedInformation": []
}
],
"data": {
"specifier": "file:///a/file.ts",
"fixId": "fixAwaitInSyncFunction"
}
}

View file

@ -1,10 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/codeLens",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
}
}
}

View file

@ -1,10 +0,0 @@
{
"jsonrpc": "2.0",
"id": 4,
"method": "textDocument/codeLens",
"params": {
"textDocument": {
"uri": "deno:/asset//lib.deno.shared_globals.d.ts"
}
}
}

View file

@ -1,21 +0,0 @@
{
"jsonrpc": "2.0",
"id": 4,
"method": "codeLens/resolve",
"params": {
"range": {
"start": {
"line": 0,
"character": 6
},
"end": {
"line": 0,
"character": 7
}
},
"data": {
"specifier": "file:///a/file.ts",
"source": "references"
}
}
}

View file

@ -1,21 +0,0 @@
{
"jsonrpc": "2.0",
"id": 5,
"method": "codeLens/resolve",
"params": {
"range": {
"start": {
"line": 416,
"character": 12
},
"end": {
"line": 416,
"character": 19
}
},
"data": {
"specifier": "asset:///lib.deno.shared_globals.d.ts",
"source": "references"
}
}
}

View file

@ -1,21 +0,0 @@
{
"jsonrpc": "2.0",
"id": 4,
"method": "codeLens/resolve",
"params": {
"range": {
"start": {
"line": 0,
"character": 10
},
"end": {
"line": 0,
"character": 11
}
},
"data": {
"specifier": "file:///a/file.ts",
"source": "implementations"
}
}
}

View file

@ -0,0 +1,38 @@
{
"range": {
"start": {
"line": 0,
"character": 6
},
"end": {
"line": 0,
"character": 7
}
},
"command": {
"title": "1 reference",
"command": "deno.showReferences",
"arguments": [
"file:///a/file.ts",
{
"line": 0,
"character": 6
},
[
{
"uri": "file:///a/file.ts",
"range": {
"start": {
"line": 12,
"character": 14
},
"end": {
"line": 12,
"character": 15
}
}
}
]
]
}
}

View file

@ -0,0 +1,38 @@
{
"range": {
"start": {
"line": 0,
"character": 10
},
"end": {
"line": 0,
"character": 11
}
},
"command": {
"title": "1 implementation",
"command": "deno.showReferences",
"arguments": [
"file:///a/file.ts",
{
"line": 0,
"character": 10
},
[
{
"uri": "file:///a/file.ts",
"range": {
"start": {
"line": 4,
"character": 6
},
"end": {
"line": 4,
"character": 7
}
}
}
]
]
}
}

View file

@ -0,0 +1,34 @@
[
{
"range": {
"start": {
"line": 0,
"character": 6
},
"end": {
"line": 0,
"character": 7
}
},
"data": {
"specifier": "file:///a/file.ts",
"source": "references"
}
},
{
"range": {
"start": {
"line": 1,
"character": 2
},
"end": {
"line": 1,
"character": 3
}
},
"data": {
"specifier": "file:///a/file.ts",
"source": "references"
}
}
]

View file

@ -0,0 +1,50 @@
[
{
"range": {
"start": {
"line": 0,
"character": 10
},
"end": {
"line": 0,
"character": 11
}
},
"data": {
"specifier": "file:///a/file.ts",
"source": "implementations"
}
},
{
"range": {
"start": {
"line": 0,
"character": 10
},
"end": {
"line": 0,
"character": 11
}
},
"data": {
"specifier": "file:///a/file.ts",
"source": "references"
}
},
{
"range": {
"start": {
"line": 4,
"character": 6
},
"end": {
"line": 4,
"character": 7
}
},
"data": {
"specifier": "file:///a/file.ts",
"source": "references"
}
}
]

View file

@ -1,18 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/completion",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
},
"position": {
"line": 0,
"character": 5
},
"context": {
"triggerKind": 2,
"triggerCharacter": "."
}
}
}

View file

@ -1,18 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/completion",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
},
"position": {
"line": 8,
"character": 4
},
"context": {
"triggerKind": 2,
"triggerCharacter": "."
}
}
}

View file

@ -0,0 +1,13 @@
{
"textDocument": {
"uri": "file:///a/file.ts"
},
"position": {
"line": 8,
"character": 4
},
"context": {
"triggerKind": 2,
"triggerCharacter": "."
}
}

View file

@ -1,18 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/completion",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
},
"position": {
"line": 0,
"character": 46
},
"context": {
"triggerKind": 2,
"triggerCharacter": "@"
}
}
}

View file

@ -1,18 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/completion",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
},
"position": {
"line": 0,
"character": 20
},
"context": {
"triggerKind": 2,
"triggerCharacter": "\""
}
}
}

View file

@ -0,0 +1,38 @@
{
"isIncomplete": false,
"items": [
{
"label": ".",
"kind": 19,
"detail": "(local)",
"sortText": "1",
"insertText": "."
},
{
"label": "..",
"kind": 19,
"detail": "(local)",
"sortText": "1",
"insertText": ".."
},
{
"label": "http://localhost:4545",
"kind": 19,
"detail": "(registry)",
"sortText": "2",
"textEdit": {
"range": {
"start": {
"line": 0,
"character": 20
},
"end": {
"line": 0,
"character": 20
}
},
"newText": "http://localhost:4545"
}
}
]
}

View file

@ -0,0 +1,14 @@
{
"label": "build",
"kind": 6,
"sortText": "1",
"insertTextFormat": 1,
"data": {
"tsc": {
"specifier": "file:///a/file.ts",
"position": 5,
"name": "build",
"useCodeSnippet": false
}
}
}

View file

@ -0,0 +1,15 @@
{
"label": "b?",
"kind": 5,
"sortText": "1",
"filterText": "b",
"insertText": "b",
"data": {
"tsc": {
"specifier": "file:///a/file.ts",
"position": 79,
"name": "b",
"useCodeSnippet": false
}
}
}

View file

@ -0,0 +1,20 @@
{
"label": "v2.0.0",
"kind": 19,
"detail": "(version)",
"sortText": "0000000003",
"filterText": "http://localhost:4545/x/a@v2.0.0",
"textEdit": {
"range": {
"start": {
"line": 0,
"character": 20
},
"end": {
"line": 0,
"character": 46
}
},
"newText": "http://localhost:4545/x/a@v2.0.0"
}
}

View file

@ -1,19 +0,0 @@
{
"jsonrpc": "2.0",
"id": 4,
"method": "completionItem/resolve",
"params": {
"label": "build",
"kind": 6,
"sortText": "1",
"insertTextFormat": 1,
"data": {
"tsc": {
"specifier": "file:///a/file.ts",
"position": 5,
"name": "build",
"useCodeSnippet": false
}
}
}
}

View file

@ -1,20 +0,0 @@
{
"jsonrpc": "2.0",
"id": 4,
"method": "completionItem/resolve",
"params": {
"label": "b?",
"kind": 5,
"sortText": "1",
"filterText": "b",
"insertText": "b",
"data": {
"tsc": {
"specifier": "file:///a/file.ts",
"position": 79,
"name": "b",
"useCodeSnippet": false
}
}
}
}

View file

@ -1,25 +0,0 @@
{
"jsonrpc": "2.0",
"id": 4,
"method": "completionItem/resolve",
"params": {
"label": "v2.0.0",
"kind": 19,
"detail": "(version)",
"sortText": "0000000003",
"filterText": "http://localhost:4545/x/a@v2.0.0",
"textEdit": {
"range": {
"start": {
"line": 0,
"character": 20
},
"end": {
"line": 0,
"character": 46
}
},
"newText": "http://localhost:4545/x/a@v2.0.0"
}
}
}

View file

@ -0,0 +1,11 @@
{
"label": "build",
"kind": 6,
"detail": "const Deno.build: {\n target: string;\n arch: \"x86_64\" | \"aarch64\";\n os: \"darwin\" | \"linux\" | \"windows\";\n vendor: string;\n env?: string | undefined;\n}",
"documentation": {
"kind": "markdown",
"value": "Build related information."
},
"sortText": "1",
"insertTextFormat": 1
}

View file

@ -0,0 +1,20 @@
{
"label": "v2.0.0",
"kind": 19,
"detail": "(version)",
"sortText": "0000000003",
"filterText": "http://localhost:4545/x/a@v2.0.0",
"textEdit": {
"range": {
"start": {
"line": 0,
"character": 20
},
"end": {
"line": 0,
"character": 46
}
},
"newText": "http://localhost:4545/x/a@v2.0.0"
}
}

View file

@ -1,14 +0,0 @@
{
"jsonrpc": "2.0",
"id": 4,
"method": "textDocument/definition",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
},
"position": {
"line": 0,
"character": 14
}
}
}

View file

@ -1,25 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didChange",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"version": 2
},
"contentChanges": [
{
"range": {
"start": {
"line": 444,
"character": 11
},
"end": {
"line": 444,
"character": 14
}
},
"text": "+++"
}
]
}
}

View file

@ -1,25 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didChange",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"version": 2
},
"contentChanges": [
{
"range": {
"start": {
"line": 445,
"character": 4
},
"end": {
"line": 445,
"character": 4
}
},
"text": "// "
}
]
}
}

View file

@ -1,25 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didChange",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"version": 2
},
"contentChanges": [
{
"range": {
"start": {
"line": 477,
"character": 4
},
"end": {
"line": 477,
"character": 9
}
},
"text": "error"
}
]
}
}

View file

@ -1,25 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didChange",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"version": 2
},
"contentChanges": [
{
"range": {
"start": {
"line": 1,
"character": 11
},
"end": {
"line": 1,
"character": 13
}
},
"text": ""
}
]
}
}

View file

@ -1,12 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "console.log(Deno.args);\n"
}
}
}

View file

@ -1,12 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "console.log(Date.now());\n"
}
}
}

View file

@ -1,12 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "import * as a from \"https://deno.land/x/a/mod.ts\";\n\nconsole.log(a);\n"
}
}
}

View file

@ -1,12 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "interface A {\n b(): void;\n}\n\nclass B implements A {\n b() {\n console.log(\"b\");\n }\n}\n"
}
}
}

View file

@ -1,12 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "class A {\n a = \"a\";\n\n b() {\n console.log(this.a);\n }\n\n c() {\n this.a = \"c\";\n }\n}\n\nconst a = new A();\na.b();\n"
}
}
}

View file

@ -1,12 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "export function a(): void {\n await Promise.resolve(\"a\");\n}\n\nexport function b(): void {\n await Promise.resolve(\"b\");\n}\n"
}
}
}

View file

@ -1,12 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "interface A {\n b?: string;\n}\n\nconst o: A = {};\n\nfunction c(s: string) {}\n\nc(o.)"
}
}
}

View file

@ -1,12 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "import * as a from \"http://localhost:4545/x/a@\""
}
}
}

View file

@ -1,12 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "import * as a from \"\""
}
}
}

View file

@ -1,12 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "Deno."
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -1,12 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "const a = `编写软件很难`;\nconst b = `👍🦕😃`;\nconsole.log(a, b);\n"
}
}
}

View file

@ -1,12 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "const bar = '👍🇺🇸😃'\nconsole.log('hello deno')\n"
}
}
}

View file

@ -1,12 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "console.log(Deno.openPlugin);\n"
}
}
}

View file

@ -0,0 +1,8 @@
{
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "interface IFoo {\n foo(): boolean;\n}\n\nclass Bar implements IFoo {\n constructor(public x: number) { }\n foo() { return true; }\n /** @deprecated */\n baz() { return false; }\n get value(): number { return 0; }\n set value(newVavlue: number) { return; }\n static staticBar = new Bar(0);\n private static getStaticBar() { return Bar.staticBar; }\n}\n\nenum Values { value1, value2 }\n\nvar bar: IFoo = new Bar(3);"
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,8 @@
{
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "enum Values { value1, value2 }\n\nasync function baz(s: string): Promise<string> {\n const r = s.slice(0);\n return r;\n}\n\ninterface IFoo {\n readonly x: number;\n foo(): boolean;\n}\n\nclass Bar implements IFoo {\n constructor(public readonly x: number) { }\n foo() { return true; }\n static staticBar = new Bar(0);\n private static getStaticBar() { return Bar.staticBar; }\n}\n"
}
}

View file

@ -1,12 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "interface IFoo {\n foo(): boolean;\n}\n\nclass Bar implements IFoo {\n constructor(public x: number) { }\n foo() { return true; }\n /** @deprecated */\n baz() { return false; }\n get value(): number { return 0; }\n set value(newVavlue: number) { return; }\n static staticBar = new Bar(0);\n private static getStaticBar() { return Bar.staticBar; }\n}\n\nenum Values { value1, value2 }\n\nvar bar: IFoo = new Bar(3);"
}
}
}

View file

@ -1,10 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/documentSymbol",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
}
}
}

View file

@ -0,0 +1,371 @@
[
{
"name": "bar",
"kind": 13,
"range": {
"start": {
"line": 17,
"character": 4
},
"end": {
"line": 17,
"character": 26
}
},
"selectionRange": {
"start": {
"line": 17,
"character": 4
},
"end": {
"line": 17,
"character": 7
}
}
},
{
"name": "Bar",
"kind": 5,
"range": {
"start": {
"line": 4,
"character": 0
},
"end": {
"line": 13,
"character": 1
}
},
"selectionRange": {
"start": {
"line": 4,
"character": 6
},
"end": {
"line": 4,
"character": 9
}
},
"children": [
{
"name": "constructor",
"kind": 9,
"range": {
"start": {
"line": 5,
"character": 2
},
"end": {
"line": 5,
"character": 35
}
},
"selectionRange": {
"start": {
"line": 5,
"character": 2
},
"end": {
"line": 5,
"character": 35
}
}
},
{
"name": "baz",
"kind": 6,
"tags": [
1
],
"range": {
"start": {
"line": 8,
"character": 2
},
"end": {
"line": 8,
"character": 25
}
},
"selectionRange": {
"start": {
"line": 8,
"character": 2
},
"end": {
"line": 8,
"character": 5
}
}
},
{
"name": "foo",
"kind": 6,
"range": {
"start": {
"line": 6,
"character": 2
},
"end": {
"line": 6,
"character": 24
}
},
"selectionRange": {
"start": {
"line": 6,
"character": 2
},
"end": {
"line": 6,
"character": 5
}
}
},
{
"name": "getStaticBar",
"kind": 6,
"range": {
"start": {
"line": 12,
"character": 2
},
"end": {
"line": 12,
"character": 57
}
},
"selectionRange": {
"start": {
"line": 12,
"character": 17
},
"end": {
"line": 12,
"character": 29
}
}
},
{
"name": "staticBar",
"kind": 7,
"range": {
"start": {
"line": 11,
"character": 2
},
"end": {
"line": 11,
"character": 32
}
},
"selectionRange": {
"start": {
"line": 11,
"character": 9
},
"end": {
"line": 11,
"character": 18
}
}
},
{
"name": "value",
"kind": 7,
"range": {
"start": {
"line": 9,
"character": 2
},
"end": {
"line": 9,
"character": 35
}
},
"selectionRange": {
"start": {
"line": 9,
"character": 6
},
"end": {
"line": 9,
"character": 11
}
}
},
{
"name": "value",
"kind": 7,
"range": {
"start": {
"line": 10,
"character": 2
},
"end": {
"line": 10,
"character": 42
}
},
"selectionRange": {
"start": {
"line": 10,
"character": 6
},
"end": {
"line": 10,
"character": 11
}
}
},
{
"name": "x",
"kind": 7,
"range": {
"start": {
"line": 5,
"character": 14
},
"end": {
"line": 5,
"character": 30
}
},
"selectionRange": {
"start": {
"line": 5,
"character": 21
},
"end": {
"line": 5,
"character": 22
}
}
}
]
},
{
"name": "IFoo",
"kind": 11,
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 2,
"character": 1
}
},
"selectionRange": {
"start": {
"line": 0,
"character": 10
},
"end": {
"line": 0,
"character": 14
}
},
"children": [
{
"name": "foo",
"kind": 6,
"range": {
"start": {
"line": 1,
"character": 2
},
"end": {
"line": 1,
"character": 17
}
},
"selectionRange": {
"start": {
"line": 1,
"character": 2
},
"end": {
"line": 1,
"character": 5
}
}
}
]
},
{
"name": "Values",
"kind": 10,
"range": {
"start": {
"line": 15,
"character": 0
},
"end": {
"line": 15,
"character": 30
}
},
"selectionRange": {
"start": {
"line": 15,
"character": 5
},
"end": {
"line": 15,
"character": 11
}
},
"children": [
{
"name": "value1",
"kind": 13,
"range": {
"start": {
"line": 15,
"character": 14
},
"end": {
"line": 15,
"character": 20
}
},
"selectionRange": {
"start": {
"line": 15,
"character": 14
},
"end": {
"line": 15,
"character": 20
}
}
},
{
"name": "value2",
"kind": 13,
"range": {
"start": {
"line": 15,
"character": 22
},
"end": {
"line": 15,
"character": 28
}
},
"selectionRange": {
"start": {
"line": 15,
"character": 22
},
"end": {
"line": 15,
"character": 28
}
}
}
]
}
]

View file

@ -1,5 +0,0 @@
{
"jsonrpc": "2.0",
"method": "exit",
"params": null
}

View file

@ -1,12 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "// #region 1\n/*\n * Some comment\n */\nclass Foo {\n bar(a, b) {\n if (a === b) {\n return true;\n }\n return false;\n }\n}\n// #endregion"
}
}
}

View file

@ -1,10 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/foldingRange",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
}
}
}

View file

@ -0,0 +1,54 @@
[
{
"range": {
"start": {
"line": 0,
"character": 12
},
"end": {
"line": 0,
"character": 13
}
},
"newText": "\""
},
{
"range": {
"start": {
"line": 0,
"character": 21
},
"end": {
"line": 0,
"character": 22
}
},
"newText": "\";"
},
{
"range": {
"start": {
"line": 1,
"character": 12
},
"end": {
"line": 1,
"character": 13
}
},
"newText": "\""
},
{
"range": {
"start": {
"line": 1,
"character": 23
},
"end": {
"line": 1,
"character": 25
}
},
"newText": "\");"
}
]

View file

@ -1,14 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/formatting",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
},
"options": {
"tabSize": 2,
"insertSpaces": true
}
}
}

View file

@ -1,14 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/hover",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
},
"position": {
"line": 0,
"character": 19
}
}
}

View file

@ -1,14 +0,0 @@
{
"jsonrpc": "2.0",
"id": 5,
"method": "textDocument/hover",
"params": {
"textDocument": {
"uri": "deno:/asset//lib.es2015.symbol.wellknown.d.ts"
},
"position": {
"line": 109,
"character": 13
}
}
}

View file

@ -1,14 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/hover",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
},
"position": {
"line": 421,
"character": 30
}
}
}

View file

@ -1,14 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/hover",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
},
"position": {
"line": 444,
"character": 6
}
}
}

View file

@ -1,14 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/hover",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
},
"position": {
"line": 461,
"character": 34
}
}
}

View file

@ -1,14 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/hover",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
},
"position": {
"line": 2,
"character": 15
}
}
}

View file

@ -0,0 +1,28 @@
{
"item": {
"name": "baz",
"kind": 6,
"detail": "Bar",
"uri": "file:///a/file.ts",
"range": {
"start": {
"line": 5,
"character": 2
},
"end": {
"line": 7,
"character": 3
}
},
"selectionRange": {
"start": {
"line": 5,
"character": 2
},
"end": {
"line": 5,
"character": 5
}
}
}
}

View file

@ -1,33 +0,0 @@
{
"jsonrpc": "2.0",
"id": 4,
"method": "callHierarchy/incomingCalls",
"params": {
"item": {
"name": "baz",
"kind": 6,
"detail": "Bar",
"uri": "file:///a/file.ts",
"range": {
"start": {
"line": 5,
"character": 2
},
"end": {
"line": 7,
"character": 3
}
},
"selectionRange": {
"start": {
"line": 5,
"character": 2
},
"end": {
"line": 5,
"character": 5
}
}
}
}
}

View file

@ -0,0 +1,42 @@
[
{
"from": {
"name": "main",
"kind": 12,
"detail": "",
"uri": "file:///a/file.ts",
"range": {
"start": {
"line": 10,
"character": 0
},
"end": {
"line": 13,
"character": 1
}
},
"selectionRange": {
"start": {
"line": 10,
"character": 9
},
"end": {
"line": 10,
"character": 13
}
}
},
"fromRanges": [
{
"start": {
"line": 12,
"character": 6
},
"end": {
"line": 12,
"character": 9
}
}
]
}
]

View file

@ -0,0 +1,56 @@
{
"processId": 0,
"clientInfo": {
"name": "test-harness",
"version": "1.0.0"
},
"rootUri": null,
"initializationOptions": {
"enable": true,
"codeLens": {
"implementations": true,
"references": true
},
"importMap": null,
"lint": true,
"suggest": {
"autoImports": true,
"completeFunctionCalls": false,
"names": true,
"paths": true,
"imports": {
"hosts": {}
}
},
"unstable": false
},
"capabilities": {
"textDocument": {
"codeAction": {
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"quickfix"
]
}
},
"isPreferredSupport": true,
"dataSupport": true,
"resolveSupport": {
"properties": [
"edit"
]
}
},
"foldingRange": {
"lineFoldingOnly": true
},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
}
}
}
}

View file

@ -0,0 +1,56 @@
{
"processId": 0,
"clientInfo": {
"name": "test-harness",
"version": "1.0.0"
},
"rootUri": null,
"initializationOptions": {
"enable": false,
"codeLens": {
"implementations": true,
"references": true
},
"importMap": null,
"lint": true,
"suggest": {
"autoImports": true,
"completeFunctionCalls": false,
"names": true,
"paths": true,
"imports": {
"hosts": {}
}
},
"unstable": false
},
"capabilities": {
"textDocument": {
"codeAction": {
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"quickfix"
]
}
},
"isPreferredSupport": true,
"dataSupport": true,
"resolveSupport": {
"properties": [
"edit"
]
}
},
"foldingRange": {
"lineFoldingOnly": true
},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
}
}
}
}

View file

@ -0,0 +1,58 @@
{
"processId": 0,
"clientInfo": {
"name": "test-harness",
"version": "1.0.0"
},
"rootUri": null,
"initializationOptions": {
"enable": true,
"codeLens": {
"implementations": true,
"references": true
},
"importMap": null,
"lint": true,
"suggest": {
"autoImports": true,
"completeFunctionCalls": false,
"names": true,
"paths": true,
"imports": {
"hosts": {
"http://localhost:4545/": true
}
}
},
"unstable": false
},
"capabilities": {
"textDocument": {
"codeAction": {
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"quickfix"
]
}
},
"isPreferredSupport": true,
"dataSupport": true,
"resolveSupport": {
"properties": [
"edit"
]
}
},
"foldingRange": {
"lineFoldingOnly": true
},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
}
}
}
}

View file

@ -0,0 +1,56 @@
{
"processId": 0,
"clientInfo": {
"name": "test-harness",
"version": "1.0.0"
},
"rootUri": null,
"initializationOptions": {
"enable": true,
"codeLens": {
"implementations": true,
"references": true
},
"importMap": null,
"lint": true,
"suggest": {
"autoImports": true,
"completeFunctionCalls": false,
"names": true,
"paths": true,
"imports": {
"hosts": {}
}
},
"unstable": true
},
"capabilities": {
"textDocument": {
"codeAction": {
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"quickfix"
]
}
},
"isPreferredSupport": true,
"dataSupport": true,
"resolveSupport": {
"properties": [
"edit"
]
}
},
"foldingRange": {
"lineFoldingOnly": true
},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
}
}
}
}

View file

@ -1,61 +0,0 @@
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"processId": 0,
"clientInfo": {
"name": "test-harness",
"version": "1.0.0"
},
"rootUri": null,
"initializationOptions": {
"enable": true,
"codeLens": {
"implementations": true,
"references": true
},
"importMap": null,
"lint": true,
"suggest": {
"autoImports": true,
"completeFunctionCalls": false,
"names": true,
"paths": true,
"imports": {
"hosts": {}
}
},
"unstable": false
},
"capabilities": {
"textDocument": {
"codeAction": {
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"quickfix"
]
}
},
"isPreferredSupport": true,
"dataSupport": true,
"resolveSupport": {
"properties": [
"edit"
]
}
},
"foldingRange": {
"lineFoldingOnly": true
},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
}
}
}
}
}

View file

@ -1,29 +0,0 @@
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"processId": 0,
"clientInfo": {
"name": "test-harness",
"version": "1.0.0"
},
"rootUri": null,
"initializationOptions": {
"enable": false,
"lint": true,
"importMap": null,
"unstable": false
},
"capabilities": {
"textDocument": {
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
}
}
}
}
}

View file

@ -1,63 +0,0 @@
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"processId": 0,
"clientInfo": {
"name": "test-harness",
"version": "1.0.0"
},
"rootUri": null,
"initializationOptions": {
"enable": true,
"codeLens": {
"implementations": true,
"references": true
},
"importMap": null,
"lint": true,
"suggest": {
"autoImports": true,
"completeFunctionCalls": false,
"names": true,
"paths": true,
"imports": {
"hosts": {
"http://localhost:4545/": true
}
}
},
"unstable": false
},
"capabilities": {
"textDocument": {
"codeAction": {
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"quickfix"
]
}
},
"isPreferredSupport": true,
"dataSupport": true,
"resolveSupport": {
"properties": [
"edit"
]
}
},
"foldingRange": {
"lineFoldingOnly": true
},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
}
}
}
}
}

View file

@ -1,30 +0,0 @@
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"processId": 0,
"clientInfo": {
"name": "test-harness",
"version": "1.0.0"
},
"rootUri": null,
"initializationOptions": {
"enable": true,
"lint": true,
"unstable": true,
"config": null,
"importMap": null
},
"capabilities": {
"textDocument": {
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
}
}
}
}
}

View file

@ -1,5 +0,0 @@
{
"jsonrpc": "2.0",
"method": "initialized",
"params": {}
}

View file

@ -0,0 +1,28 @@
{
"item": {
"name": "baz",
"kind": 6,
"detail": "Bar",
"uri": "file:///a/file.ts",
"range": {
"start": {
"line": 5,
"character": 2
},
"end": {
"line": 7,
"character": 3
}
},
"selectionRange": {
"start": {
"line": 5,
"character": 2
},
"end": {
"line": 5,
"character": 5
}
}
}
}

View file

@ -1,33 +0,0 @@
{
"jsonrpc": "2.0",
"id": 5,
"method": "callHierarchy/outgoingCalls",
"params": {
"item": {
"name": "baz",
"kind": 6,
"detail": "Bar",
"uri": "file:///a/file.ts",
"range": {
"start": {
"line": 5,
"character": 2
},
"end": {
"line": 7,
"character": 3
}
},
"selectionRange": {
"start": {
"line": 5,
"character": 2
},
"end": {
"line": 5,
"character": 5
}
}
}
}
}

View file

@ -0,0 +1,42 @@
[
{
"to": {
"name": "foo",
"kind": 12,
"detail": "",
"uri": "file:///a/file.ts",
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 2,
"character": 1
}
},
"selectionRange": {
"start": {
"line": 0,
"character": 9
},
"end": {
"line": 0,
"character": 12
}
}
},
"fromRanges": [
{
"start": {
"line": 6,
"character": 11
},
"end": {
"line": 6,
"character": 14
}
}
]
}
]

View file

@ -1,6 +0,0 @@
{
"jsonrpc": "2.0",
"id": 99,
"method": "deno/performance",
"params": {}
}

View file

@ -1,12 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "function foo() {\n return false;\n}\n\nclass Bar {\n baz() {\n return foo();\n }\n}\n\nfunction main() {\n const bar = new Bar();\n bar.baz();\n}\n\nmain();"
}
}
}

View file

@ -1,14 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/prepareCallHierarchy",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
},
"position": {
"line": 5,
"character": 3
}
}
}

View file

@ -0,0 +1,28 @@
[
{
"name": "baz",
"kind": 6,
"detail": "Bar",
"uri": "file:///a/file.ts",
"range": {
"start": {
"line": 5,
"character": 2
},
"end": {
"line": 7,
"character": 3
}
},
"selectionRange": {
"start": {
"line": 5,
"character": 2
},
"end": {
"line": 5,
"character": 5
}
}
}
]

View file

@ -1,17 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/references",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
},
"position": {
"line": 0,
"character": 3
},
"context": {
"includeDeclaration": true
}
}
}

View file

@ -1,12 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "let variable = 'a';\nconsole.log(variable);"
}
}
}

View file

@ -1,15 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/rename",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
},
"position": {
"line": 0,
"character": 4
},
"newName": "variable_modified"
}
}

View file

@ -0,0 +1,38 @@
{
"documentChanges": [
{
"textDocument": {
"uri": "file:///a/file.ts",
"version": 1
},
"edits": [
{
"range": {
"start": {
"line": 0,
"character": 4
},
"end": {
"line": 0,
"character": 12
}
},
"newText": "variable_modified"
},
{
"range": {
"start": {
"line": 1,
"character": 12
},
"end": {
"line": 1,
"character": 20
}
},
"newText": "variable_modified"
}
]
}
]
}

View file

@ -1,12 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "class Foo {\n bar(a, b) {\n if (a === b) {\n return true;\n }\n return false;\n }\n}"
}
}
}

View file

@ -1,16 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/selectionRange",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
},
"positions": [
{
"line": 2,
"character": 8
}
]
}
}

View file

@ -0,0 +1,86 @@
[
{
"range": {
"start": {
"line": 2,
"character": 8
},
"end": {
"line": 2,
"character": 9
}
},
"parent": {
"range": {
"start": {
"line": 2,
"character": 8
},
"end": {
"line": 2,
"character": 15
}
},
"parent": {
"range": {
"start": {
"line": 2,
"character": 4
},
"end": {
"line": 4,
"character": 5
}
},
"parent": {
"range": {
"start": {
"line": 1,
"character": 13
},
"end": {
"line": 6,
"character": 2
}
},
"parent": {
"range": {
"start": {
"line": 1,
"character": 2
},
"end": {
"line": 6,
"character": 3
}
},
"parent": {
"range": {
"start": {
"line": 0,
"character": 11
},
"end": {
"line": 7,
"character": 0
}
},
"parent": {
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 7,
"character": 1
}
}
}
}
}
}
}
}
}
]

View file

@ -1,12 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didOpen",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "enum Values { value1, value2 }\n\nasync function baz(s: string): Promise<string> {\n const r = s.slice(0);\n return r;\n}\n\ninterface IFoo {\n readonly x: number;\n foo(): boolean;\n}\n\nclass Bar implements IFoo {\n constructor(public readonly x: number) { }\n foo() { return true; }\n static staticBar = new Bar(0);\n private static getStaticBar() { return Bar.staticBar; }\n}\n"
}
}
}

View file

@ -1,10 +0,0 @@
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/semanticTokens/full",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
}
}
}

View file

@ -1,20 +0,0 @@
{
"jsonrpc": "2.0",
"id": 4,
"method": "textDocument/semanticTokens/range",
"params": {
"textDocument": {
"uri": "file:///a/file.ts"
},
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 6,
"character": 0
}
}
}
}

View file

@ -1,6 +0,0 @@
{
"jsonrpc": "2.0",
"id": 3,
"method": "shutdown",
"params": null
}

View file

@ -1,25 +0,0 @@
{
"jsonrpc": "2.0",
"method": "textDocument/didChange",
"params": {
"textDocument": {
"uri": "file:///a/file.ts",
"version": 2
},
"contentChanges": [
{
"range": {
"start": {
"line": 9,
"character": 4
},
"end": {
"line": 9,
"character": 4
}
},
"text": "123, "
}
]
}
}

Some files were not shown because too many files have changed in this diff Show more