basics.carbon 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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/document_symbol/basics.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/language_server/testdata/document_symbol/basics.carbon
  10. // --- STDIN
  11. [[@LSP-NOTIFY:textDocument/didOpen:
  12. "textDocument": {"uri": "file:/empty.carbon", "languageId": "carbon",
  13. "text": ""}
  14. ]]
  15. [[@LSP-CALL:textDocument/documentSymbol:
  16. "textDocument": {"uri": "file:/empty.carbon"}
  17. ]]
  18. [[@LSP-NOTIFY:textDocument/didOpen:
  19. "textDocument": {"uri": "file:/invalid.carbon", "languageId": "carbon",
  20. "text": "text"}
  21. ]]
  22. [[@LSP-CALL:textDocument/documentSymbol:
  23. "textDocument": {"uri": "file:/invalid.carbon"}
  24. ]]
  25. [[@LSP-NOTIFY:textDocument/didOpen:
  26. "textDocument": {"uri": "file:/fn.carbon", "languageId": "carbon",
  27. "text": "fn F() {}"}
  28. ]]
  29. [[@LSP-CALL:textDocument/documentSymbol:
  30. "textDocument": {"uri": "file:/fn.carbon"}
  31. ]]
  32. [[@LSP-NOTIFY:exit]]
  33. // --- AUTOUPDATE-SPLIT
  34. // CHECK:STDOUT: Content-Length: 49{{\r}}
  35. // CHECK:STDOUT: {{\r}}
  36. // CHECK:STDOUT: {
  37. // CHECK:STDOUT: "id": 1,
  38. // CHECK:STDOUT: "jsonrpc": "2.0",
  39. // CHECK:STDOUT: "result": []
  40. // CHECK:STDOUT: }Content-Length: 49{{\r}}
  41. // CHECK:STDOUT: {{\r}}
  42. // CHECK:STDOUT: {
  43. // CHECK:STDOUT: "id": 2,
  44. // CHECK:STDOUT: "jsonrpc": "2.0",
  45. // CHECK:STDOUT: "result": []
  46. // CHECK:STDOUT: }Content-Length: 459{{\r}}
  47. // CHECK:STDOUT: {{\r}}
  48. // CHECK:STDOUT: {
  49. // CHECK:STDOUT: "id": 3,
  50. // CHECK:STDOUT: "jsonrpc": "2.0",
  51. // CHECK:STDOUT: "result": [
  52. // CHECK:STDOUT: {
  53. // CHECK:STDOUT: "kind": 12,
  54. // CHECK:STDOUT: "name": "F",
  55. // CHECK:STDOUT: "range": {
  56. // CHECK:STDOUT: "end": {
  57. // CHECK:STDOUT: "character": 7,
  58. // CHECK:STDOUT: "line": 0
  59. // CHECK:STDOUT: },
  60. // CHECK:STDOUT: "start": {
  61. // CHECK:STDOUT: "character": 7,
  62. // CHECK:STDOUT: "line": 0
  63. // CHECK:STDOUT: }
  64. // CHECK:STDOUT: },
  65. // CHECK:STDOUT: "selectionRange": {
  66. // CHECK:STDOUT: "end": {
  67. // CHECK:STDOUT: "character": 7,
  68. // CHECK:STDOUT: "line": 0
  69. // CHECK:STDOUT: },
  70. // CHECK:STDOUT: "start": {
  71. // CHECK:STDOUT: "character": 7,
  72. // CHECK:STDOUT: "line": 0
  73. // CHECK:STDOUT: }
  74. // CHECK:STDOUT: }
  75. // CHECK:STDOUT: }
  76. // CHECK:STDOUT: ]
  77. // CHECK:STDOUT: }