{"id":33174,"date":"2021-07-20T16:23:33","date_gmt":"2021-07-20T20:23:33","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=33174"},"modified":"2021-07-26T14:56:45","modified_gmt":"2021-07-26T18:56:45","slug":"bbedit-14","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2021\/07\/20\/bbedit-14\/","title":{"rendered":"BBEdit 14"},"content":{"rendered":"<p><a href=\"https:\/\/www.barebones.com\/support\/bbedit\/lsp-notes.html\">Bare Bones Software<\/a> (<a href=\"https:\/\/twitter.com\/bbedit\/status\/1417192647291248641\">tweet<\/a>):<\/p>\n<blockquote cite=\"https:\/\/www.barebones.com\/support\/bbedit\/lsp-notes.html\"><p>BBEdit 14.0 and later feature built-in support for the <a href=\"https:\/\/microsoft.github.io\/language-server-protocol\/\">Language Server Protocol<\/a>,\n(occasionally referred to here as &ldquo;LSP&rdquo;, not to be confused with\nLightspeed Pascal).<\/p><p>[&#8230;]<\/p><p>Completions supplied by the language server are significantly more accurate and complete than those available using the built-in mechanisms.<\/p><p>If a language server supports the &ldquo;signature help&rdquo; feature, BBEdit enables the &ldquo;Show Parameter Help&rdquo; command on the Edit menu; choosing this will open a panel providing assistance for filling in function parameters at the current insertion point (if applicable).<\/p><p>If a language server reports issues (errors and warnings) for a file in which you&rsquo;re editing, ranges corresponding to those issues get highlighted according to their severity, and the corresponding lines are highlighted in the line number bar.<\/p><p>[&#8230;]<\/p><p>Command-double-click on a word will direct the request to an appropriate language server and perform the equivalent of &ldquo;Go to Definition&rdquo;, if possible.<\/p><\/blockquote>\n\n<p>I&rsquo;m really excited about this, as it enables all sorts of IDE-type features. I&rsquo;d long hoped that Xcode would add an API to make its indexing information available to external editors. In a way, this is better because it also works with languages not supported by Xcode. It uses an open protocol that&rsquo;s implemented by various open-source language implementations. If you&rsquo;re using a custom language, you can write your own LSP server.<\/p>\n\n<p>As you might expect, to get this working requires installing a server package for each language (links <a href=\"https:\/\/www.barebones.com\/support\/bbedit\/lsp-notes.html#preconfigured\">here<\/a>). C-family languages and Swift &ldquo;work&rdquo; out of the box if you have Xcode installed. I put that in quotes because, <a href=\"https:\/\/www.barebones.com\/support\/bbedit\/lsp-notes.html#caveats\">although<\/a> the language server is pre-installed and pre-configured:<\/p>\n\n<blockquote cite=\"https:\/\/www.barebones.com\/support\/bbedit\/lsp-notes.html#caveats\"><p><code>clangd<\/code> relies on a &ldquo;compilation database&rdquo; which provides necessary information\nabout compiler options and lists the files relevant to the current project workspace.\nThe compilation database is a JSON file named &ldquo;<code>compile_commands.json<\/code>&rdquo; which lives at\nthe root directory of the project.<\/p><\/blockquote>\n\n<p>Without this, it won&rsquo;t even know what <code>NSString<\/code> is. There&rsquo;s a sample shell script that you can set up to generate the <code>compile_commands.json<\/code> for each Xcode project. Note that this JSON only contains information about the project files and how they&rsquo;re compiled. It&rsquo;s not a list of the actual symbols to be indexed, like with <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ctags\">ctags<\/a>, so it does not need to be regenerated frequently.<\/p>\n\n<p>One issue I ran into is loose C\/Objective-C files that aren&rsquo;t part of an Xcode project. For example, I like to view\/search the header files from Apple&rsquo;s SDKs. It&rsquo;s not obvious how to generate a compilation database for those files, nor where to put it. So I end up with spurious warnings about types (even <code>intptr_t<\/code>) and macros (such as <code>API_AVAILABLE<\/code>) that were declared in an included file. My workaround for this is to configure <tt>.h<\/tt> files as Objective-C++ and then turn off LSP for Objective-C++ files. I mostly care about it in <tt>.m<\/tt> files, anyway.<\/p>\n\n<p>The compilation database does not include information about Swift files, and <code>sourcekit-lsp<\/code> for Swift doesn&rsquo;t seem to be able to figure out my project structure itself. So, when editing a Swift file, I get live reporting of syntax errors, which is great, but it doesn&rsquo;t offer completions of symbols from the same framework or know how to find definitions. But neither, thankfully, does it show warnings for symbols that it doesn&rsquo;t know about.<\/p>\n\n<p>More new stuff from the <a href=\"https:\/\/www.barebones.com\/support\/bbedit\/notes-14.0.html\">release notes<\/a>:<\/p>\n<blockquote cite=\"https:\/\/www.barebones.com\/support\/bbedit\/notes-14.0.html\"><p>Notes are mostly like ordinary text documents, except that you don&rsquo;t have to remember to save them or even make up a name if you don&rsquo;t want to. BBEdit keeps notes all together in a &ldquo;notebook&rdquo;. Notes exist on disk as text files; there&rsquo;s no secret file format involved.<\/p><p>[&#8230;]<\/p><p>Added &ldquo;Repeat Last Command&rdquo; to the Edit menu.<\/p><p>[&#8230;]<\/p><p>When dragging an image or an HTML file into a Markdown document, BBEdit will generate appropriately formatted Markdown references.<\/p><p>[&#8230;]<\/p><p>Added the ability to drag files (not folders) from an FTP\/SFTP browser window to the Finder (and other applications that want files). When the item is dropped in its destination, BBEdit will download the file as indicated.<\/p><p>[&#8230;]<\/p><p>Added &ldquo;Precompose Unicode&rdquo; to the Text menu. This command will convert decomposed Unicode pairs (such as a letter followed by a combining accent or diaresis) into a single Unicode character, where possible.<\/p><p>[&#8230;]<\/p><p>Added a new script attachment point, to provide additional control over the text generated when you drop an image file into a BBEdit editing view.<\/p><\/blockquote>\n\n<p>It also adds language modules for R, Lisp, Go, and Rust&mdash;and a nice new icon for Big Sur. This is definitely one of the bigger BBEdit upgrades.<\/p>\n\n<p>Pricing is unchanged, $50 for new licenses and $30 for upgrades.<\/p>\n\n<p>See also:<\/p>\n<ul>\n<li><a href=\"https:\/\/sixcolors.com\/post\/2021\/07\/bbedit-14-0-arrives-with-notes-and-lsp-support\/\">Jason Snell<\/a><\/li>\n<li><a href=\"https:\/\/micro.coyotetracks.org\/2021\/07\/19\/bbedit-and-why.html\">Watts Martin<\/a><\/li>\n<li><a href=\"https:\/\/jonathanbuys.com\/Setting_up_BBEdit_14's_Python_Language_Server_Protocol\/\">Jonathan Buys<\/a><\/li>\n<li><a href=\"https:\/\/www.macobserver.com\/podcasts\/tmo-daily-observations-2021-07-20\/\">TMO Podcast<\/a><\/li>\n<\/ul>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2020\/10\/14\/bbedit-13-5\/\">BBEdit 13.5<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2019\/10\/04\/bbedit-13\/\">BBEdit 13<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2018\/10\/16\/swift-language-server-protocol-service\/\">Swift Language Server Protocol Service<\/a><\/li>\n<\/ul>\n\n<p id=\"bbedit-14-update-2021-07-26\">Update (2021-07-26): See also: <a href=\"https:\/\/news.ycombinator.com\/item?id=27905644\">Hacker News<\/a>, <a href=\"https:\/\/tidbits.com\/2021\/07\/21\/bbedit-14-adds-simple-notes-management\/\">TidBITS<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Bare Bones Software (tweet): BBEdit 14.0 and later feature built-in support for the Language Server Protocol, (occasionally referred to here as &ldquo;LSP&rdquo;, not to be confused with Lightspeed Pascal).[&#8230;]Completions supplied by the language server are significantly more accurate and complete than those available using the built-in mechanisms.If a language server supports the &ldquo;signature help&rdquo; feature, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2021-07-20T20:23:39Z","apple_news_api_id":"faf8ac8e-8ca1-4e84-ae4d-133d8a0f356b","apple_news_api_modified_at":"2021-07-26T18:56:50Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAg==","apple_news_api_share_url":"https:\/\/apple.news\/A-visjoyhToSuTRM9ig81aw","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[2],"tags":[154,30,32,1891,54,74,71,232,790,901,68,258],"class_list":["post-33174","post","type-post","status-publish","format-standard","hentry","category-technology","tag-bbedit","tag-mac","tag-macapp","tag-macos-11-0","tag-objective-c","tag-opensource","tag-programming","tag-python","tag-sftp","tag-swift-programming-language","tag-texteditor","tag-unicode"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/33174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=33174"}],"version-history":[{"count":4,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/33174\/revisions"}],"predecessor-version":[{"id":33220,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/33174\/revisions\/33220"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=33174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=33174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=33174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}