Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming class does not rename file #112

Open
huyby opened this issue Aug 1, 2024 · 1 comment
Open

Renaming class does not rename file #112

huyby opened this issue Aug 1, 2024 · 1 comment

Comments

@huyby
Copy link

huyby commented Aug 1, 2024

I'm using a licensed intelephense which allows renaming classes and try to rename the file if the file already follows a convention where the namespace matches the directory.

This feature works in VSCode, but in Sublime Text only the class name and references are changed. I used the same code project to compare the feature in both IDE's.

Anyone with the same issue?

Below the relevant LSP logs from Sublime:

: [10:08:14.420] --> LSP-intelephense initialize (1): {'processId': 24370, 'clientInfo': {'name': 'Sublime Text LSP', 'version': '2.2.0'}, 'rootUri': 'file:///Volumes/Projects', 'rootPath': '/Volumes/Projects', 'workspaceFolders': [{'name': 'apps-finance', 'uri': 'file:///Volumes/Projects'}], 'capabilities': {'general': {'regularExpressions': {'engine': 'ECMAScript'}, 'markdown': {'parser': 'Python-Markdown', 'version': '3.2.2'}}, 'textDocument': {'synchronization': {'dynamicRegistration': True, 'didSave': True, 'willSave': True, 'willSaveWaitUntil': True}, 'hover': {'dynamicRegistration': True, 'contentFormat': ['markdown', 'plaintext']}, 'completion': {'dynamicRegistration': True, 'completionItem': {'snippetSupport': True, 'deprecatedSupport': True, 'documentationFormat': ['markdown', 'plaintext'], 'tagSupport': {'valueSet': [1]}, 'resolveSupport': {'properties': ['detail', 'documentation', 'additionalTextEdits']}, 'insertReplaceSupport': True, 'insertTextModeSupport': {'valueSet': [2]}, 'labelDetailsSupport': 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]}, 'insertTextMode': 2, 'completionList': {'itemDefaults': ['editRange', 'insertTextFormat', 'data']}}, 'signatureHelp': {'dynamicRegistration': True, 'contextSupport': True, 'signatureInformation': {'activeParameterSupport': True, 'documentationFormat': ['markdown', 'plaintext'], 'parameterInformation': {'labelOffsetSupport': True}}}, 'references': {'dynamicRegistration': True}, 'documentHighlight': {'dynamicRegistration': True}, 'documentSymbol': {'dynamicRegistration': True, 'hierarchicalDocumentSymbolSupport': 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]}, 'tagSupport': {'valueSet': [1]}}, 'documentLink': {'dynamicRegistration': True, 'tooltipSupport': True}, 'formatting': {'dynamicRegistration': True}, 'rangeFormatting': {'dynamicRegistration': True, 'rangesSupport': True}, 'declaration': {'dynamicRegistration': True, 'linkSupport': True}, 'definition': {'dynamicRegistration': True, 'linkSupport': True}, 'typeDefinition': {'dynamicRegistration': True, 'linkSupport': True}, 'implementation': {'dynamicRegistration': True, 'linkSupport': True}, 'codeAction': {'dynamicRegistration': True, 'codeActionLiteralSupport': {'codeActionKind': {'valueSet': ['quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.rewrite', 'source.fixAll', 'source.organizeImports']}}, 'dataSupport': True, 'isPreferredSupport': True, 'resolveSupport': {'properties': ['edit']}}, 'rename': {'dynamicRegistration': True, 'prepareSupport': True, 'prepareSupportDefaultBehavior': 1}, 'colorProvider': {'dynamicRegistration': True}, 'publishDiagnostics': {'relatedInformation': True, 'tagSupport': {'valueSet': [1, 2]}, 'versionSupport': True, 'codeDescriptionSupport': True, 'dataSupport': True}, 'diagnostic': {'dynamicRegistration': True, 'relatedDocumentSupport': True}, 'selectionRange': {'dynamicRegistration': True}, 'foldingRange': {'dynamicRegistration': True, 'foldingRangeKind': {'valueSet': ['comment', 'imports', 'region']}}, 'codeLens': {'dynamicRegistration': True}, 'inlayHint': {'dynamicRegistration': True, 'resolveSupport': {'properties': ['textEdits', 'label.command']}}, 'semanticTokens': {'dynamicRegistration': True, 'requests': {'range': True, 'full': {'delta': True}}, 'tokenTypes': ['namespace', 'type', 'class', 'enum', 'interface', 'struct', 'typeParameter', 'parameter', 'variable', 'property', 'enumMember', 'event', 'function', 'method', 'macro', 'keyword', 'modifier', 'comment', 'string', 'number', 'regexp', 'operator', 'decorator'], 'tokenModifiers': ['declaration', 'definition', 'readonly', 'static', 'deprecated', 'abstract', 'async', 'modification', 'documentation', 'defaultLibrary'], 'formats': ['relative'], 'overlappingTokenSupport': False, 'multilineTokenSupport': True, 'augmentsSyntaxTokens': True}, 'callHierarchy': {'dynamicRegistration': True}, 'typeHierarchy': {'dynamicRegistration': True}}, 'workspace': {'applyEdit': True, 'didChangeConfiguration': {'dynamicRegistration': True}, 'executeCommand': {}, 'workspaceEdit': {'documentChanges': True, 'failureHandling': 'abort'}, 'workspaceFolders': True, 'symbol': {'dynamicRegistration': True, 'resolveSupport': {'properties': ['location.range']}, '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]}, 'tagSupport': {'valueSet': [1]}}, 'configuration': True, 'codeLens': {'refreshSupport': True}, 'inlayHint': {'refreshSupport': True}, 'semanticTokens': {'refreshSupport': True}, 'diagnostics': {'refreshSupport': True}}, 'window': {'showDocument': {'support': True}, 'showMessage': {'messageActionItem': {'additionalPropertiesSupport': True}}, 'workDoneProgress': True}}, 'initializationOptions': {'clearCache': False, 'licenceKey': '*************'}}
:: [10:08:53.653] <<< LSP-intelephense (1) (duration: 1372ms): {'capabilities': {'documentSymbolProvider': True, 'workspaceSymbolProvider': True, 'completionProvider': {'triggerCharacters': ['$', '>', ':', '\\', '/', "'", '"', '*', '.', '<'], 'resolveProvider': True}, 'signatureHelpProvider': {'triggerCharacters': ['(', ',', ':']}, 'definitionProvider': True, 'documentFormattingProvider': False, 'documentRangeFormattingProvider': False, 'referencesProvider': True, 'hoverProvider': True, 'documentHighlightProvider': True, 'foldingRangeProvider': True, 'implementationProvider': True, 'declarationProvider': True, 'workspace': {'workspaceFolders': {'supported': True, 'changeNotifications': True}}, 'renameProvider': {'prepareProvider': True}, 'typeDefinitionProvider': True, 'selectionRangeProvider': True, 'codeActionProvider': True, 'executeCommandProvider': {'commands': ['intelephense.import.symbol', 'intelephense.implement.abstract.method.all', 'intelephense.phpdoc.add']}, 'typeHierarchyProvider': True, 'textDocumentSync': {'didOpen': {}, 'save': {}, 'didClose': {}, 'change': {'syncKind': 2}}}}

File contents before rename action

<?php

declare(strict_types=1);

namespace App\Test;

class TestRename
{

}

Rename log

:: [10:40:21.235] --> LSP-intelephense textDocument/prepareRename (39): {'textDocument': {'uri': 'file:///Volumes/Projects/app/Test/TestRename.php'}, 'position': {'line': 6, 'character': 6}, 'workDoneToken': '$ublime-work-done-progress-39'}
:: [10:40:21.236] <<< LSP-intelephense (39) (duration: 1ms): {'start': {'line': 6, 'character': 6}, 'end': {'line': 6, 'character': 16}}
:: [10:40:22.939] --> LSP-intelephense textDocument/rename (40): {'textDocument': {'uri': 'file:///Volumes/Projects/app/Test/TestRename.php'}, 'position': {'line': 6, 'character': 6}, 'newName': 'TestRenamed', 'workDoneToken': '$ublime-work-done-progress-40'}
:: [10:40:22.941] <<< LSP-intelephense (40) (duration: 1ms): {'documentChanges': [{'textDocument': {'uri': 'file:///Volumes/Projects/app/Test/TestRename.php', 'version': 42}, 'edits': [{'range': {'start': {'line': 6, 'character': 6}, 'end': {'line': 6, 'character': 16}}, 'newText': 'TestRenamed'}]}]}
:: [10:40:23.020]  -> LSP-intelephense textDocument/didChange: {'textDocument': {'uri': 'file:///Volumes/Projects/app/Test/TestRename.php', 'version': 43}, 'contentChanges': [{'range': {'start': {'line': 6, 'character': 6}, 'end': {'line': 6, 'character': 16}}, 'rangeLength': 10, 'text': 'TestRenamed'}]}
:: [10:40:23.020]  -> LSP-intelephense textDocument/didSave: {'textDocument': {'uri': 'file:///Volumes/Projects/app/Test/TestRename.php'}}
:: [10:40:23.264]  -> LSP-copilot textDocument/didChange: {'textDocument': {'uri': 'file:///Volumes/Projects/app/Test/TestRename.php', 'version': 43}, 'contentChanges': [{'range': {'start': {'line': 6, 'character': 6}, 'end': {'line': 6, 'character': 16}}, 'rangeLength': 10, 'text': 'TestRenamed'}]}

File contents after rename action

<?php

declare(strict_types=1);

namespace App\Test;

class TestRenamed
{

}

File name not changed after rename action

Screenshot 2024-08-01 at 10 43 36

@jfcherng
Copy link
Collaborator

jfcherng commented Aug 1, 2024

This feature works in VSCode

Then most likely sublimelsp/LSP#2498

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants