언어 서버 프로토콜을 초기화 할 수 없습니다.

스티븐 음탕 구

나는 LSP 주위에서 놀고 있는데 첫 단계를 지나칠 수 없습니다. 작업이 간단하기 때문에 Python을 클라이언트 언어로 사용하고 있습니다. 내가하는 일은 :

  1. LSP에 연결-잘 작동합니다.
  2. 초기화 JSON RPC 보내기-클라이언트 보고서 성공
  3. 응답 받기-빈 결과

나는 내가 할 수있는 모든 것을 시도했고 내가 찾을 수있는 것을 읽었지만 성공하지 못했습니다. LSP에 더 정통한 사람이 내가 뭘 잘못하고 있는지 지적하는 데 도움이되기를 바랍니다.

다음은 내 Python 코드입니다. 나는 PHP 언어 서버로 시도했지만 사용되는 서버의 종류는 중요하지 않습니다.

import socket
import sys 

initReq = """
{
    "jsonrpc": "2.0",
    "id": 1,
    "method": " initialize",
    "params": {
        "processId": null,
        "rootPath": "/Users/stefano/Testing/PHPSources",
        "rootUri": "file:///Users/stefano/Testing/PHPSources",
        "capabilities": {
            "workspace": {
                "applyEdit": true,
                "workspaceEdit": {
                    "documentChanges": true,
                    "resourceOperations": [
                        "create",
                        "rename",
                        "delete"
                    ],
                    "failureHandling": "textOnlyTransactional"
                },
                "didChangeConfiguration": {
                    "dynamicRegistration": true
                },
                "didChangeWatchedFiles": {
                    "dynamicRegistration": true
                },
                "symbol": {
                    "dynamicRegistration": true,
                    "symbolKind": {
                        "valueSet": [
                            1,
                            2,
                            3,
                            4,
                            5,
                            6,
                            7,
                            8,
                            9,
                            10,
                            11,
                            12,
                            13,
                            14,
                            15,
                            16,
                            17,
                            18,
                            19,
                            20,
                            21,
                            22,
                            23,
                            24,
                            25,
                            26
                        ]
                    }
                },
                "executeCommand": {
                    "dynamicRegistration": true
                },
                "configuration": true,
                "workspaceFolders": true
            },
            "textDocument": {
                "publishDiagnostics": {
                    "relatedInformation": true,
                    "tagSupport": true
                },
                "synchronization": {
                    "dynamicRegistration": true,
                    "willSave": true,
                    "willSaveWaitUntil": true,
                    "didSave": true
                },
                "completion": {
                    "dynamicRegistration": true,
                    "contextSupport": true,
                    "completionItem": {
                        "snippetSupport": true,
                        "commitCharactersSupport": true,
                        "documentationFormat": [
                            "markdown",
                            "plaintext"
                        ],
                        "deprecatedSupport": true,
                        "preselectSupport": true
                    },
                    "completionItemKind": {
                        "valueSet": [
                            1,
                            2,
                            3,
                            4,
                            5,
                            6,
                            7,
                            8,
                            9,
                            10,
                            11,
                            12,
                            13,
                            14,
                            15,
                            16,
                            17,
                            18,
                            19,
                            20,
                            21,
                            22,
                            23,
                            24,
                            25
                        ]
                    }
                },
                "hover": {
                    "dynamicRegistration": true,
                    "contentFormat": [
                        "markdown",
                        "plaintext"
                    ]
                },
                "signatureHelp": {
                    "dynamicRegistration": true,
                    "signatureInformation": {
                        "documentationFormat": [
                            "markdown",
                            "plaintext"
                        ],
                        "parameterInformation": {
                            "labelOffsetSupport": true
                        }
                    }
                },
                "definition": {
                    "dynamicRegistration": true,
                    "linkSupport": true
                },
                "references": {
                    "dynamicRegistration": true
                },
                "documentHighlight": {
                    "dynamicRegistration": true
                },
                "documentSymbol": {
                    "dynamicRegistration": true,
                    "symbolKind": {
                        "valueSet": [
                            1,
                            2,
                            3,
                            4,
                            5,
                            6,
                            7,
                            8,
                            9,
                            10,
                            11,
                            12,
                            13,
                            14,
                            15,
                            16,
                            17,
                            18,
                            19,
                            20,
                            21,
                            22,
                            23,
                            24,
                            25,
                            26
                        ]
                    },
                    "hierarchicalDocumentSymbolSupport": true
                },
                "codeAction": {
                    "dynamicRegistration": true,
                    "codeActionLiteralSupport": {
                        "codeActionKind": {
                            "valueSet": [
                                "",
                                "quickfix",
                                "refactor",
                                "refactor.extract",
                                "refactor.inline",
                                "refactor.rewrite",
                                "source",
                                "source.organizeImports"
                            ]
                        }
                    }
                },
                "codeLens": {
                    "dynamicRegistration": true
                },
                "formatting": {
                    "dynamicRegistration": true
                },
                "rangeFormatting": {
                    "dynamicRegistration": true
                },
                "onTypeFormatting": {
                    "dynamicRegistration": true
                },
                "rename": {
                    "dynamicRegistration": true,
                    "prepareSupport": true
                },
                "documentLink": {
                    "dynamicRegistration": true
                },
                "typeDefinition": {
                    "dynamicRegistration": true,
                    "linkSupport": true
                },
                "implementation": {
                    "dynamicRegistration": true,
                    "linkSupport": true
                },
                "colorProvider": {
                    "dynamicRegistration": true
                },
                "foldingRange": {
                    "dynamicRegistration": true,
                    "rangeLimit": 5000,
                    "lineFoldingOnly": true
                },
                "declaration": {
                    "dynamicRegistration": true,
                    "linkSupport": true
                }
            }
        },
        "initializationOptions": {
            "storagePath": "/Users/hosanna/Library/Application Support/Code/User/workspaceStorage/30bd6a399166f4f329c9f383d63b74ca/bmewburn.vscode-intelephense-client",
            "clearCache": false
        },
        "trace": "verbose",
        "workspaceFolders": [
            {
                "uri": "file:///Users/stefano/Testing/PHPSources",
                "name": "TransportationApp"
            }
        ]
    }
}
"""

host = '127.0.0.1'
port = 8088

# create socket
print('# Creating socket')
try:
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
except socket.error:
    print('Failed to create socket')
    sys.exit()

# Connect to remote server
print('# Connecting to server, ' + host)
s.connect((host , port))

# Send data to remote server
print('# Sending data to server')

try:
    s.sendall(initReq.encode('utf-8'))
except socket.error:
    print('Send failed')
    sys.exit()

# Receive data
print('# Receive data from server')
reply = s.recv(4096)

print(reply) 
스티븐 음탕 구

헤더 부분과 각각의 새 줄이 누락되었습니다. Github도움주신 rcjsuen 에게 감사드립니다.

참조 형식은 다음과 같아야합니다.

Content-Length: <length>\r\n
\r\n
{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "textDocument/didOpen",
    "params": {
        ...
    }
}

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

eclipse 4.9는 10 초 후에 초기화되지 않은 언어 서버로 인해 완전히 사용할 수 없습니다.

SwiftUI보기에서 프로토콜을 사용할 수 없습니다.

JMeter에서 여러 프로토콜을 기록 할 수 없습니다.

Vim 또는 NeoVim과 함께 VSCode 언어-서버-프로토콜 엔진을 사용할 수 있습니까?

유형을 문자열로 초기화 할 수 있어야하는 프로토콜이 존재합니까?

Android에서 Parse 용 Mandrill을 초기화 할 수 없습니다.

Julia에서 큰 행렬을 초기화 할 수 없습니다.

초기화에서 유형을 변환 할 수 없습니다.

Spring은 "dev"프로필에서 Bean을 초기화 할 수 없습니다.

RadioButton을 확인할 수 없습니다. 버튼을 어떻게 초기화합니까?

신속한 질문: 프로토콜 유형인 경우 if else 블록에서 선택적이 아닌 변수를 어떻게 초기화할 수 있습니까?

Kotlin-컴패니언 객체 값을 초기화 할 수 없습니다.

Swift에서 MKAnnotation 프로토콜을 준수 할 수 없습니다.

'Xcode에서 "UIViewControllerAnimatedTransitioning"의 프로토콜 선언을 찾을 수 없습니다.'

NoClassDefFoundError : 프로덕션 환경에서 OauthRawGcsServiceFactory를 초기화 할 수 없습니다.

Electron-프로그램을 초기화 할 수 없습니다.

초기화 프로그램에서 인스턴스 멤버 'currentComponentConfiguration'에 액세스 할 수 없습니다.

초기화 프로그램에서 인스턴스 멤버 'params'에 액세스 할 수 없습니다.

초기화 프로그램에서 인스턴스 멤버 'setState'에 액세스 할 수 없습니다.

C / C ++ 언어 서버를 시작할 수 없습니다. IntelliSense 기능이 비활성화됩니다.

클래스의 재미에서 도달 할 수있는 초기화없이 Kotlin에서 val을 어떻게 선언 할 수 있습니까?

Windows 10에서 전화 프로토콜 처리기를 변경할 수 없습니다.

프로토콜 버퍼에서 2 차원 배열을 어떻게 표현할 수 있습니까?

classpath:wsdl에서 기본 wsdl을 초기화할 수 없습니다.

기본 구현이 있는 프로토콜을 초기화할 수 없는 이유는 무엇입니까?

AJAX 응답에서 DataTable을 다시 초기화할 수 없습니다.

AngularJS에서 다른 값을 어떻게 초기화 할 수 있습니까?

Scala에서 할당 / 초기화 전에 val을 선언 할 수 있습니까?

올바른 디렉토리에서 Firebase를 초기화 할 수 없습니다.

TOP 리스트

  1. 1

    셀레늄의 모델 대화 상자에서 텍스트를 추출하는 방법은 무엇입니까?

  2. 2

    Blazor 0.9.0 및 ASP.NET Core 3 미리보기 4를 사용한 JWT 인증

  3. 3

    openCV python을 사용하여 텍스트 문서에서 워터 마크를 제거하는 방법은 무엇입니까?

  4. 4

    C # 16 진수 값 0x12는 잘못된 문자입니다.

  5. 5

    Excel : 합계가 N보다 크거나 같은 상위 값 찾기

  6. 6

    오류 : MSB4803 : MSBuild의 .NET Core 버전에서 "ResolveComReference"작업이 지원되지 않습니다.

  7. 7

    R에서 Excel로 내보낼 때 CET / CEST 시간 이동이 삭제됨

  8. 8

    node.js + postgres : "$ 1"또는 그 근처에서 구문 오류

  9. 9

    확대 후 하이 차트에서 Y 축이 잘못 정렬 됨

  10. 10

    EPPlus에서 행 높이를 설정할 때 이상한 동작

  11. 11

    Ionic 2 로더가 적시에 표시되지 않음

  12. 12

    MS Access 부분 일치 2 테이블

  13. 13

    EPPlus에서 병합 된 셀의 행 높이 자동 맞춤

  14. 14

    ExecuteNonQuery- 연결 속성이 초기화되지 않았습니다.

  15. 15

    ResponseEntity를 사용하고 InputStream이 닫히는 지 확인하는 적절한 스트리밍 방법

  16. 16

    PrematureCloseException : 연결이 너무 일찍 닫혔습니다.

  17. 17

    오류 : "const wchar_t *"유형의 인수가 "WCHAR *"유형의 매개 변수와 호환되지 않습니다.

  18. 18

    Java에서 이미지를 2 색으로 변환

  19. 19

    overflow-y를 사용할 때 스크롤 버벅 거림 줄이기 : scroll;

  20. 20

    Java에서 Apache POI를 사용하여 테이블 크기 및 간격을 단어로 설정하는 방법

  21. 21

    Android Kotlin은 다른 활동에서 함수를 호출합니다.

뜨겁다태그

보관