open_with_cpp_nonexistent.carbon 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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_with_cpp_nonexistent.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_with_cpp_nonexistent.carbon
  10. // --- STDIN
  11. [[@LSP-CALL:initialize]]
  12. [[@LSP-NOTIFY:textDocument/didOpen:
  13. "textDocument": {"uri": "file:/test.carbon", "languageId": "carbon",
  14. "text": "import Cpp library \"nonexistent.h\";"}
  15. ]]
  16. [[@LSP-NOTIFY:textDocument/didClose:
  17. "textDocument": {"uri": "file:/test.carbon"}
  18. ]]
  19. [[@LSP-CALL:shutdown]]
  20. [[@LSP-NOTIFY:exit]]
  21. // --- AUTOUPDATE-SPLIT
  22. // CHECK:STDOUT: Content-Length: 146{{\r}}
  23. // CHECK:STDOUT: {{\r}}
  24. // CHECK:STDOUT: {
  25. // CHECK:STDOUT: "id": 1,
  26. // CHECK:STDOUT: "jsonrpc": "2.0",
  27. // CHECK:STDOUT: "result": {
  28. // CHECK:STDOUT: "capabilities": {
  29. // CHECK:STDOUT: "documentSymbolProvider": true,
  30. // CHECK:STDOUT: "textDocumentSync": 2
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT: }Content-Length: 443{{\r}}
  34. // CHECK:STDOUT: {{\r}}
  35. // CHECK:STDOUT: {
  36. // CHECK:STDOUT: "jsonrpc": "2.0",
  37. // CHECK:STDOUT: "method": "textDocument/publishDiagnostics",
  38. // CHECK:STDOUT: "params": {
  39. // CHECK:STDOUT: "diagnostics": [
  40. // CHECK:STDOUT: {
  41. // CHECK:STDOUT: "message": "in import",
  42. // CHECK:STDOUT: "range": {
  43. // CHECK:STDOUT: "end": {
  44. // CHECK:STDOUT: "character": 36,
  45. // CHECK:STDOUT: "line": 1
  46. // CHECK:STDOUT: },
  47. // CHECK:STDOUT: "start": {
  48. // CHECK:STDOUT: "character": 0,
  49. // CHECK:STDOUT: "line": 0
  50. // CHECK:STDOUT: }
  51. // CHECK:STDOUT: },
  52. // CHECK:STDOUT: "severity": 1,
  53. // CHECK:STDOUT: "source": "carbon"
  54. // CHECK:STDOUT: }
  55. // CHECK:STDOUT: ],
  56. // CHECK:STDOUT: "uri": "file:///test.carbon"
  57. // CHECK:STDOUT: }
  58. // CHECK:STDOUT: }Content-Length: 144{{\r}}
  59. // CHECK:STDOUT: {{\r}}
  60. // CHECK:STDOUT: {
  61. // CHECK:STDOUT: "jsonrpc": "2.0",
  62. // CHECK:STDOUT: "method": "textDocument/publishDiagnostics",
  63. // CHECK:STDOUT: "params": {
  64. // CHECK:STDOUT: "diagnostics": [],
  65. // CHECK:STDOUT: "uri": "file:///test.carbon"
  66. // CHECK:STDOUT: }
  67. // CHECK:STDOUT: }Content-Length: 51{{\r}}
  68. // CHECK:STDOUT: {{\r}}
  69. // CHECK:STDOUT: {
  70. // CHECK:STDOUT: "id": 2,
  71. // CHECK:STDOUT: "jsonrpc": "2.0",
  72. // CHECK:STDOUT: "result": null
  73. // CHECK:STDOUT: }