This is a patch to add a refactoring to Clangd that mimics the existing refactoring action in Xcode that wraps around an Objective-C string literal in an NSLocalizedString macro.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang-tools-extra/clangd/unittests/TweakTests.cpp | ||
---|---|---|
127 | make sure this is rebased on top of http://github.com/llvm/llvm-project/commit/1a9c01c7f6c7e88676440869bbbe9f43fa45b109 | |
129 | maybe use raw string literals? R"(@"teststring")" |
I figured out what I was doing wrong in the tests, and fixed them. This is no longer WIP and is ready for review.
implementation lgtm with a few nits.
main concern is about the new getlangopts helper
clang-tools-extra/clangd/ParsedAST.h | ||
---|---|---|
80 ↗ | (On Diff #228548) | can we introduce this helper in a new patch, while changing other occurrences in clangd? |
clang-tools-extra/clangd/refactor/tweaks/ObjCLocalizeStringLiteral.cpp | ||
35 | NSLocalizedString(@"description", @"") | |
70 | maybe extract Inputs.AST.getASTContext().getLangOpts() into a variable and make use of it in the following places as well? (line 72 and 75) | |
clang-tools-extra/clangd/unittests/TweakTests.cpp | ||
131 | nit: you can combine all of this into a single test | |
136 | nit: you can combine all of this into a single test |
Thanks, LGTM!
clang-tools-extra/clangd/ParsedAST.h | ||
---|---|---|
80 ↗ | (On Diff #228548) | can you also revert this change? |
clang-tools-extra/clangd/ParsedAST.h | ||
---|---|---|
80 ↗ | (On Diff #228548) | I precommited it in c0ee0224c4cf52bc6ba74dec88b30b850deca523 |
NSLocalizedString(@"description", @"")