open_change_close.carbon 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/language_server/testdata/text_document/open_change_close.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/language_server/testdata/text_document/open_change_close.carbon
  10. // --- STDIN
  11. [[@LSP-CALL:initialize]]
  12. [[@LSP-NOTIFY:textDocument/didOpen:
  13. "textDocument": {"uri": "file:/test.carbon", "languageId": "carbon",
  14. "text": "// Empty"}
  15. ]]
  16. [[@LSP-NOTIFY:textDocument/didChange:
  17. "textDocument": {"uri": "file:/test.carbon"},
  18. "contentChanges": [{"text": "// Differently empty"}]
  19. ]]
  20. [[@LSP-NOTIFY:textDocument/didClose:
  21. "textDocument": {"uri": "file:/test.carbon"}
  22. ]]
  23. [[@LSP-CALL:shutdown]]
  24. [[@LSP-NOTIFY:exit]]
  25. // --- AUTOUPDATE-SPLIT
  26. // CHECK:STDOUT: Content-Length: 146{{\r}}
  27. // CHECK:STDOUT: {{\r}}
  28. // CHECK:STDOUT: {
  29. // CHECK:STDOUT: "id": 1,
  30. // CHECK:STDOUT: "jsonrpc": "2.0",
  31. // CHECK:STDOUT: "result": {
  32. // CHECK:STDOUT: "capabilities": {
  33. // CHECK:STDOUT: "documentSymbolProvider": true,
  34. // CHECK:STDOUT: "textDocumentSync": 2
  35. // CHECK:STDOUT: }
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT: }Content-Length: 144{{\r}}
  38. // CHECK:STDOUT: {{\r}}
  39. // CHECK:STDOUT: {
  40. // CHECK:STDOUT: "jsonrpc": "2.0",
  41. // CHECK:STDOUT: "method": "textDocument/publishDiagnostics",
  42. // CHECK:STDOUT: "params": {
  43. // CHECK:STDOUT: "diagnostics": [],
  44. // CHECK:STDOUT: "uri": "file:///test.carbon"
  45. // CHECK:STDOUT: }
  46. // CHECK:STDOUT: }Content-Length: 144{{\r}}
  47. // CHECK:STDOUT: {{\r}}
  48. // CHECK:STDOUT: {
  49. // CHECK:STDOUT: "jsonrpc": "2.0",
  50. // CHECK:STDOUT: "method": "textDocument/publishDiagnostics",
  51. // CHECK:STDOUT: "params": {
  52. // CHECK:STDOUT: "diagnostics": [],
  53. // CHECK:STDOUT: "uri": "file:///test.carbon"
  54. // CHECK:STDOUT: }
  55. // CHECK:STDOUT: }Content-Length: 144{{\r}}
  56. // CHECK:STDOUT: {{\r}}
  57. // CHECK:STDOUT: {
  58. // CHECK:STDOUT: "jsonrpc": "2.0",
  59. // CHECK:STDOUT: "method": "textDocument/publishDiagnostics",
  60. // CHECK:STDOUT: "params": {
  61. // CHECK:STDOUT: "diagnostics": [],
  62. // CHECK:STDOUT: "uri": "file:///test.carbon"
  63. // CHECK:STDOUT: }
  64. // CHECK:STDOUT: }Content-Length: 51{{\r}}
  65. // CHECK:STDOUT: {{\r}}
  66. // CHECK:STDOUT: {
  67. // CHECK:STDOUT: "id": 2,
  68. // CHECK:STDOUT: "jsonrpc": "2.0",
  69. // CHECK:STDOUT: "result": null
  70. // CHECK:STDOUT: }