hansec / fortran-language-server

Fortran Language Server for the Language Server Protocol
MIT License
295 stars 57 forks source link

"can't set attribute" error #132

Closed emanspeaks closed 5 years ago

emanspeaks commented 5 years ago

Just upgraded to fortls v1.10.1, and suddenly now I get an error message when I start VS Code.

From the Fortran Language Server log:

error handling request {'jsonrpc': '2.0', 'id': 0, 'method': 'initialize', 'params': {'processId': 15676, 'rootPath': 'c:\\Users\\raeckman\\git\\copernicus-devel\\src', 'rootUri': 'file:///c%3A/Users/raeckman/git/copernicus-devel/src', '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}, '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']}}, 'definition': {'dynamicRegistration': 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}, 'implementation': {'dynamicRegistration': True}, 'colorProvider': {'dynamicRegistration': True}, 'foldingRange': {'dynamicRegistration': True, 'rangeLimit': 5000, 'lineFoldingOnly': True}}}, 'trace': 'off', 'workspaceFolders': [{'uri': 'file:///c%3A/Users/raeckman/git/copernicus-devel/src', 'name': 'src'}]}}
Traceback (most recent call last):
  File "c:\miniconda\miniconda3\lib\site-packages\fortls\langserver.py", line 165, in handle
    resp = handler(request)
  File "c:\miniconda\miniconda3\lib\site-packages\fortls\langserver.py", line 269, in serve_initialize
    self.workspace_init()
  File "c:\miniconda\miniconda3\lib\site-packages\fortls\langserver.py", line 1325, in workspace_init
    file_obj.ast.resolve_links(self.obj_tree, self.link_version)
  File "c:\miniconda\miniconda3\lib\site-packages\fortls\objects.py", line 1894, in resolve_links
    linkable_obj.resolve_link(obj_tree)
  File "c:\miniconda\miniconda3\lib\site-packages\fortls\objects.py", line 1299, in resolve_link
    type_scope = climb_type_tree(var_stack, self, obj_tree)
  File "c:\miniconda\miniconda3\lib\site-packages\fortls\objects.py", line 318, in climb_type_tree
    var_obj = find_in_scope(curr_scope, var_name, obj_tree)
  File "c:\miniconda\miniconda3\lib\site-packages\fortls\objects.py", line 202, in find_in_scope
    tmp_var = find_in_scope(scope.parent, var_name, obj_tree)
  File "c:\miniconda\miniconda3\lib\site-packages\fortls\objects.py", line 202, in find_in_scope
    tmp_var = find_in_scope(scope.parent, var_name, obj_tree)
  File "c:\miniconda\miniconda3\lib\site-packages\fortls\objects.py", line 202, in find_in_scope
    tmp_var = find_in_scope(scope.parent, var_name, obj_tree)
  [Previous line repeated 1 more time]
  File "c:\miniconda\miniconda3\lib\site-packages\fortls\objects.py", line 175, in find_in_scope
    use_dict = get_use_tree(scope, {}, obj_tree)
  File "c:\miniconda\miniconda3\lib\site-packages\fortls\objects.py", line 151, in get_use_tree
    merged_use_list, merged_rename, new_path)
  File "c:\miniconda\miniconda3\lib\site-packages\fortls\objects.py", line 151, in get_use_tree
    merged_use_list, merged_rename, new_path)
  File "c:\miniconda\miniconda3\lib\site-packages\fortls\objects.py", line 151, in get_use_tree
    merged_use_list, merged_rename, new_path)
  File "c:\miniconda\miniconda3\lib\site-packages\fortls\objects.py", line 141, in get_use_tree
    use_dict[use_stmnt.mod_name].rename_map = new_rename
AttributeError: can't set attribute
hansec commented 5 years ago

Thanks for the report. This should now be fixed in master (see commit above). If this does not fix the issue please let me know. Thanks!

emanspeaks commented 5 years ago

Looks like it works now. Thanks!