From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: [semi off topic] grep-based refactoring [was: Adding refactoring capabilities to Emacs] Date: Fri, 8 Sep 2023 21:24:12 +0300 Message-ID: <5989c630-010c-845d-a931-4eb07f8511cd@gutov.dev> References: <83fs4f36wi.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9953"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: emacs-devel@gnu.org To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= , tomas@tuxteam.de Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 08 20:24:40 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qeg9l-0002E0-Hp for ged-emacs-devel@m.gmane-mx.org; Fri, 08 Sep 2023 20:24:38 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qeg9W-00010q-VB; Fri, 08 Sep 2023 14:24:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qeg9V-0000su-AL for emacs-devel@gnu.org; Fri, 08 Sep 2023 14:24:21 -0400 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qeg9R-0005eR-Vp for emacs-devel@gnu.org; Fri, 08 Sep 2023 14:24:21 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 252425C00B0; Fri, 8 Sep 2023 14:24:15 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 08 Sep 2023 14:24:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1694197455; x=1694283855; bh=STJfWge/OD3Nyj4+wO7HbP0iWFOYNrmK+mq x+PGknkQ=; b=pewPZOEjuE049+NEsoXnPFsxPpzKaSAhwz9RtxcG91FtYt6fZW2 zxelodgRCX6tJq+U81bd2Be7xLVWuX3XJz0Yho1flIEnHzYnCG0ZcwEmJ1wkofYZ 4joH4wU2p5n6oo9gEwoY7uIPkF+xWI40xNQzBdfM34Vwqvy7C5YGvGH0z9wDETNk aLaHGLrylLESFvYSLxeZcIBjq0huH9mREbhhhJwwWxixl9xwIqSKhrO1wxI3ZqYR wu6Dmzgd8wCr3m9cYDSy74xWYn2keJpMeGHr3ZMr48ATavLEu0MXYjh2eC6Yw21h B5E4nhDImDIOs4u9a/Sx+4xo0gxzI58reyw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1694197455; x=1694283855; bh=STJfWge/OD3Nyj4+wO7HbP0iWFOYNrmK+mq x+PGknkQ=; b=Vh0rtZzBYVIFymdlN9IGElKjYgMocyKm7bnAHCfQ8Ls6ws8H6l/ Wziuezl5dyKgqYIRR6CEyijTHbfmrWywhCDjWGBkPP8/L6tXeCW0suYRlHarNK0p sYdVOhyqEcBqY1jmZRpMd9KjCAts4JskkH3lr+BaDkzgFA6UcBEbdYDdXFBfadgw 6JxH3L2vmBt0Zo7dW+fqMXjB8EBdHifmkinj2U8PlaDcuayLvpT5I8KY1aZhMAWS L3zr1B3DHdomP4NM6PGtNJTcPWj5wo5xwv1qcMFfMP+ebaHE1b6wNHYIg80J3444 K6o51byhPDdiS9qx+XCGTZ6X4uotPijx01w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudehjedguddvfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfevfhfhjggtgfesthekredttdefjeenucfhrhhomhepffhm ihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrg htthgvrhhnpefhffehleejffegffeugefhkeektdffgfehjedvgeejtedtudehueffgffg feejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 8 Sep 2023 14:24:13 -0400 (EDT) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=66.111.4.26; envelope-from=dmitry@gutov.dev; helo=out2-smtp.messagingengine.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-1.473, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:310349 Archived-At: On 08/09/2023 20:53, João Távora wrote: > On Fri, Sep 8, 2023 at 2:31 PM wrote: >> On Fri, Sep 08, 2023 at 01:52:53PM +0100, João Távora wrote: >> >> [...] >> >>> Great. Precise project-wide analysis (as opposed to more-or-less dumb >>> grep-based) is exactly the main thing we should be targeting IMO. >>> Is "rename" the only thing it does or can you, say, extract subexpressions >>> to variables, organize imports, etc? >> As someone who has done quite a bit of "grep based refactoring", one >> observation: of course, this can only me made semi-manually. But then, >> the process has found things for me a syntax based refactoring tool >> wouldn't ever have, > Not sure about that. Clangd mentions this limitation specifically > in their web page, so they acknowledge it and possibly are looking > to fix it. It's not too wild to think that an LSP server might > to suggest additional edits beyond what it has from syntactic > analysis, who knows maybe even using language models or by using > a parser that understands doxygen or common types of documentation > systems using comments. As long as the identifiers are referred to in the docstrings using the proper markup. And they could also mention the same term in the free-form text which one might want to see renamed. > So the only thing we know for sure is that grep-based isn't enough. Good thing we'll have access to both anyway.