Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

It's the Final Keynote!

Slide 3

Slide 3 text

Increase Creativity!

Slide 4

Slide 4 text

Modern Dev Environments Programmer Efficiency in 2023?

Slide 5

Slide 5 text

Artificial Intelligence

Slide 6

Slide 6 text

ChatGPT

Slide 7

Slide 7 text

GitHub Copilot

Slide 8

Slide 8 text

Editors

Slide 9

Slide 9 text

VSCode

Slide 10

Slide 10 text

Language Servers

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

Technical Content

Slide 13

Slide 13 text

Hi, I'm Aaron!

Slide 14

Slide 14 text

@tenderlove @[email protected]

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

—Eileen Uchitelle “I remain on the Rails core team for you. To make Rails better for the community”

Slide 18

Slide 18 text

—Aaron “Notice me Senpai!’

Slide 19

Slide 19 text

RAILS CONF!!!!

Slide 20

Slide 20 text

Bona Fide Mycologist

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

I don’t value my time

Slide 27

Slide 27 text

Other Hobbies

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

I love programming

Slide 31

Slide 31 text

http://youtube.com/ tenderlovescoolstuff

Slide 32

Slide 32 text

http://youtube.com/ tenderlovescoolstuff CLICK HERE!!

Slide 33

Slide 33 text

Rails monkey patched that??

Slide 34

Slide 34 text

That’s not your active job!

Slide 35

Slide 35 text

I’m not saying it was Active Support, but it definitely was.

Slide 36

Slide 36 text

I am old 㻝

Slide 37

Slide 37 text

I am old 㻝

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

The best time to be a programmer is now.

Slide 40

Slide 40 text

Syntax Highlighting 㷠

Slide 41

Slide 41 text

Garbage Collection

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

Convention over Configuration

Slide 44

Slide 44 text

Making Decisions For Us

Slide 45

Slide 45 text

Example Spring Java Bean This is how we programmed in the early 2000's

Slide 46

Slide 46 text

Meetings about column names

Slide 47

Slide 47 text

Design documents about DAOs

Slide 48

Slide 48 text

Data Access Object

Slide 49

Slide 49 text

Rails: Follow the Convention and everything Just Works

Slide 50

Slide 50 text

Less Code Fewer Decisions Fewer Distractions

Slide 51

Slide 51 text

Slide 52

Slide 52 text

Thinking Sucks!

Slide 53

Slide 53 text

Think about your app, not primary key names

Slide 54

Slide 54 text

THEY DID What??

Slide 55

Slide 55 text

Artificial Intelligence Chatgpt GitHub Copilot BARD Bing chat

Slide 56

Slide 56 text

Fake Intelligence, Real Problems

Slide 57

Slide 57 text

Licensing Issues?

Slide 58

Slide 58 text

Ethics?

Slide 59

Slide 59 text

Believable Bullshit

Slide 60

Slide 60 text

Could be true?

Slide 61

Slide 61 text

Someone, Probably “AI users are only wasting their own time”

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

-- VPP (Very Patient Person) Hi, large language models like ChatGPT don't actually “know" exactly how to use command line tools like GitHub CLI, so they make up command invocations that sound plausible but may or may not exist.

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

Drudgery

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

No content

Slide 69

Slide 69 text

— Me, in the future “Copilot, please fix these tests”

Slide 70

Slide 70 text

No content

Slide 71

Slide 71 text

Red, Green, Refactor Adding the Feature / Tests Fixing the Tests Refactor the Code

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

Spend Less Time on “Boring” Tasks

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

Editors

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

Awkward!

Slide 78

Slide 78 text

Language Server

Slide 79

Slide 79 text

Language Server Protocol (LSP)

Slide 80

Slide 80 text

Language Server is a Program

Slide 81

Slide 81 text

clangd Language Server Protocol

Slide 82

Slide 82 text

clangd Language Server Protocol

Slide 83

Slide 83 text

Language Server Protocol

Slide 84

Slide 84 text

Rack

Slide 85

Slide 85 text

Technical Content

Slide 86

Slide 86 text

Developing a Language Server

Slide 87

Slide 87 text

No content

Slide 88

Slide 88 text

VSCode Extension

Slide 89

Slide 89 text

No content

Slide 90

Slide 90 text

Configuring Vim Add clangd support # Tell Vim to find vim-lsp packadd vim-lsp # Use clangd if available if executable('clangd') au User lsp_setup call lsp#register_server({ \ 'name': 'clangd', \ 'cmd': ['clangd'], \ 'allowlist': ['c'], \ }) endif Use the “clangd” command Only enable it on C files

Slide 91

Slide 91 text

Check Syntax But only check syntax on Save def foo if end

Slide 92

Slide 92 text

Communicate via STDIN / STDOUT or TCP

Slide 93

Slide 93 text

Typical Order of Operations Open foo.rb Ruby LSP Open bar.rb

Slide 94

Slide 94 text

Language Server Protocol Just JSON with a header Content-Length: 1234\r\n Content-Type: application/vscode-jsonrpc; charset=utf-8\r\n \r\n { cool:"stuff",live:"stream"...} Content-Type is optional!

Slide 95

Slide 95 text

Not Request / Response

Slide 96

Slide 96 text

Events, encoded as JSON

Slide 97

Slide 97 text

Respond to events with `id`

Slide 98

Slide 98 text

Event Message Reader Read Messages from $stdin and Parse module LSP class Reader def initialize @io = $stdin.binmode end def read buffer = @io.gets("\r\n\r\n") content_length = buffer.match(/Content-Length: (\d+)/i)[1].to_i message = @io.read(content_length) JSON.parse message, symbolize_names: true end end end Read Header in to a Buffer Get Content Length Read JSON event and parse

Slide 99

Slide 99 text

Event Message Writer Write Hash as JSON to $stdout module LSP class Writer def initialize @io = $stdout.binmode end def write response str = JSON.dump(response.merge("jsonrpc" => "2.0")) @io.write "Content-Length: #{str.bytesize}\r\n" @io.write "\r\n" @io.write str @io.flush end end end Add Required Key Calculate and write length Send JSON Body

Slide 100

Slide 100 text

Event Loop module LSP def self.run reader = Reader.new writer = Writer.new # Handle events subscriber = LSP::Events.new loop do # Read an event message = reader.read # Ask the handler to handle the event subscriber.handle message[:method], message, writer end end end

Slide 101

Slide 101 text

First Event “initialize” event Content-Length: 2683\r\n \r\n {"id":1,"jsonrpc":"2.0","method":"initialize","params":{"rootUri":"file:///Users/aaron/git/lsp-stream","capabilities":{"workspace": {"workspaceFolders":false,"configuration":true,"symbol":{"dynamicRegistration":false},"applyEdit":true},"window": {"workDoneProgress":false},"textDocument":{"callHierarchy":{"dynamicRegistration":false},"rename": {"prepareSupport":true,"dynamicRegistration":false,"prepareSupportDefaultBehavior":1},"codeAction": {"isPreferredSupport":true,"disabledSupport":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet": ["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dynamicRegistration":false },"completion":{"completionItem":{"snippetSupport":false,"resolveSupport":{"properties":["additionalTextEdits"]},"documentationFormat": ["markdown","plaintext"]},"dynamicRegistration":false,"completionItemKind":{"valueSet": [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,1,2,3,4,5,6,7,8,9]}},"formatting":{"dynamicRegistration":false},"codeLens": {"dynamicRegistration":false},"inlayHint":{"dynamicRegistration":false},"hover":{"dynamicRegistration":false,"contentFormat": ["markdown","plaintext"]},"rangeFormatting":{"dynamicRegistration":false},"declaration": {"dynamicRegistration":false,"linkSupport":true},"references":{"dynamicRegistration":false},"typeHierarchy": {"dynamicRegistration":false},"foldingRange":{"rangeLimit":5000,"dynamicRegistration":false,"lineFoldingOnly":true},"documentSymbol": {"symbolKind":{"valueSet": [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,1,2,3,4,5,6,7,8,9]},"dynamicRegistration":false,"labelSupport":false,"hierarchicalDocumentSymb olSupport":false},"publishDiagnostics":{"relatedInformation":true},"synchronization": {"dynamicRegistration":false,"willSaveWaitUntil":false,"willSave":false,"didSave":true},"documentHighlight": {"dynamicRegistration":false},"implementation":{"dynamicRegistration":false,"linkSupport":true},"typeDefinition": {"dynamicRegistration":false,"linkSupport":true},"semanticTokens":{"serverCancelSupport":false,"requests": {"full":false,"range":false},"multilineTokenSupport":false,"dynamicRegistration":false,"overlappingTokenSupport":false,"tokenTypes": ["type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","ke yword","modifier","comment","string","number","regexp","operator"],"tokenModifiers":[],"formats":["relative"]},"signatureHelp": {"dynamicRegistration":false},"definition":{"dynamicRegistration":false,"linkSupport":true}}},"rootPath":"/Users/aaron/git/lsp- stream","clientInfo":{"name":"vim-lsp"},"processId":51035,"trace":"off"}}

Slide 102

Slide 102 text

First Event “initialize” event Content-Length: 2683\r\n \r\n {"id":1,"jsonrpc":"2.0","method":"initialize","params":{"rootUri":"file:///Users/aaron/git/lsp-stream","capabilities":{"workspace": {"workspaceFolders":false,"configuration":true,"symbol":{"dynamicRegistration":false},"applyEdit":true},"window": {"workDoneProgress":false},"textDocument":{"callHierarchy":{"dynamicRegistration":false},"rename": {"prepareSupport":true,"dynamicRegistration":false,"prepareSupportDefaultBehavior":1},"codeAction": {"isPreferredSupport":true,"disabledSupport":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet": ["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dynamicRegistration":false },"completion":{"completionItem":{"snippetSupport":false,"resolveSupport":{"properties":["additionalTextEdits"]},"documentationFormat": ["markdown","plaintext"]},"dynamicRegistration":false,"completionItemKind":{"valueSet": [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,1,2,3,4,5,6,7,8,9]}},"formatting":{"dynamicRegistration":false},"codeLens": {"dynamicRegistration":false},"inlayHint":{"dynamicRegistration":false},"hover":{"dynamicRegistration":false,"contentFormat": ["markdown","plaintext"]},"rangeFormatting":{"dynamicRegistration":false},"declaration": {"dynamicRegistration":false,"linkSupport":true},"references":{"dynamicRegistration":false},"typeHierarchy": {"dynamicRegistration":false},"foldingRange":{"rangeLimit":5000,"dynamicRegistration":false,"lineFoldingOnly":true},"documentSymbol": {"symbolKind":{"valueSet": [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,1,2,3,4,5,6,7,8,9]},"dynamicRegistration":false,"labelSupport":false,"hierarchicalDocumentSymb olSupport":false},"publishDiagnostics":{"relatedInformation":true},"synchronization": {"dynamicRegistration":false,"willSaveWaitUntil":false,"willSave":false,"didSave":true},"documentHighlight": {"dynamicRegistration":false},"implementation":{"dynamicRegistration":false,"linkSupport":true},"typeDefinition": {"dynamicRegistration":false,"linkSupport":true},"semanticTokens":{"serverCancelSupport":false,"requests": {"full":false,"range":false},"multilineTokenSupport":false,"dynamicRegistration":false,"overlappingTokenSupport":false,"tokenTypes": ["type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","ke yword","modifier","comment","string","number","regexp","operator"],"tokenModifiers":[],"formats":["relative"]},"signatureHelp": {"dynamicRegistration":false},"definition":{"dynamicRegistration":false,"linkSupport":true}}},"rootPath":"/Users/aaron/git/lsp- stream","clientInfo":{"name":"vim-lsp"},"processId":51035,"trace":"off"}}

Slide 103

Slide 103 text

Event Handling Dispatch to methods based on event names module LSP class Events DISPATCH = { "initialize" => :on_initialize, "textDocument/didSave" => :did_save } def handle method, message, writer send(DISPATCH.fetch(method) { :unknown }, message, writer) end def on_initialize message, writer # ... end end end Map event names to methods Look up methods and call them

Slide 104

Slide 104 text

Initialize Message Tells the editor what features your server supports (server § editor) module LSP class Events def on_initialize message, writer result = { "capabilities" => { "textDocumentSync" => { "openClose" => true, "change" => 1,"save" => true } } } writer.write(id: message[:id], result: result) end end end Open / Close Change Save

Slide 105

Slide 105 text

Document Was Saved Editor § Server {"method":"textDocument/didSave","params":{ "textDocument":{ "uri":"file:///Users/aaron/git/minitest/test.rb"}}}

Slide 106

Slide 106 text

Document Was Saved Editor § Server {"method":"textDocument/didSave","params":{ "textDocument":{ "uri":"file:///Users/aaron/git/minitest/test.rb"}}}

Slide 107

Slide 107 text

Document Was Saved Editor § Server {"method":"textDocument/didSave","params":{ "textDocument":{ "uri":"file:///Users/aaron/git/minitest/test.rb"}}}

Slide 108

Slide 108 text

Save Events Parse the File, Report Document Diagnostics module LSP class Events def did_save message, writer doc = message.dig(:params, :textDocument) file = doc[:uri].delete_prefix("file://") result = { :uri => doc[:uri], :diagnostics => [ ] } error = check_syntax file if error line_number = error.message[/(?<=:)\d+/].to_i line = File.readlines(file)[line_number - 1] result = { :uri => doc[:uri], :diagnostics => [ { "range" => { "start" => { "character" => 0, "line" => line_number - 1 }, "end" => { "character" => line.bytesize, "line" => line_number - 1 }, }, "message" => error.message.lines.first, "severity" => 1 }, ], } end writer.write(method: "textDocument/publishDiagnostics", params: result) end end end Set our default response Check Syntax Extract the Line Information Construct Error Report Send Error Report

Slide 109

Slide 109 text

Checking Syntax Try compiling the file def check_syntax file RubyVM::InstructionSequence.compile_file(file) nil rescue SyntaxError => e e # only return syntax errors rescue Exception nil # ignore anything else end

Slide 110

Slide 110 text

That’s It!

Slide 111

Slide 111 text

Entire Language Server It fits on one slide! #!/Users/aaron/.rubies/arm64/ruby-trunk/bin/ruby require "json" module LSP class Writer def initialize @io = $stdout.binmode end def write response str = JSON.dump(response.merge("jsonrpc" => "2.0")) @io.write "Content-Length: #{str.bytesize}\r\n" @io.write "\r\n" @io.write str @io.flush end end class Reader def initialize @io = $stdin.binmode end def read buffer = @io.gets("\r\n\r\n") content_length = buffer.match(/Content-Length: (\d+)/i)[1].to_i message = @io.read(content_length) JSON.parse message, symbolize_names: true end end class Events DISPATCH = { "initialize" => :on_initialize, "textDocument/didSave" => :did_save } def handle method, message, writer send DISPATCH.fetch(method) { :unknown }, message, writer end def on_initialize message, writer result = { "capabilities" => { "textDocumentSync" => { "openClose" => true, "change" => 1,"save" => true } } } writer.write(id: message[:id], result: result) end

Slide 112

Slide 112 text

No content

Slide 113

Slide 113 text

Implement Other Events

Slide 114

Slide 114 text

Implement other Checks

Slide 115

Slide 115 text

Language Server Protocol https://microsoft.github.io/language-server-protocol/

Slide 116

Slide 116 text

https://gist.github.com/tenderlove/ 9a18be7a27ba7a074a8ba8fbf554e794

Slide 117

Slide 117 text

No content

Slide 118

Slide 118 text

Application Record So Many Generated Methods! class User < ApplicationRecord end

Slide 119

Slide 119 text

Routes Files Even More Generated Methods! Rails.application.routes.draw do resources :users resources :posts end

Slide 120

Slide 120 text

Tapioca https://github.com/Shopify/tapioca

Slide 121

Slide 121 text

— Me, in my head, but now out loud at RailsConf “What if Rails had a built-in Language Server?”

Slide 122

Slide 122 text

Prototype: Refreshing https://github.com/tenderlove/refreshing

Slide 123

Slide 123 text

Hover Info for Active Record

Slide 124

Slide 124 text

No content

Slide 125

Slide 125 text

Jump to “Definition”

Slide 126

Slide 126 text

No content

Slide 127

Slide 127 text

Hover Info for URL Helpers

Slide 128

Slide 128 text

No content

Slide 129

Slide 129 text

NICE!

Slide 130

Slide 130 text

Jump to Definition for URL Helpers 㷉

Slide 131

Slide 131 text

No content

Slide 132

Slide 132 text

Automatic Refreshing and Error Highlighting

Slide 133

Slide 133 text

No content

Slide 134

Slide 134 text

We’re all TDD’ing our views though, right?

Slide 135

Slide 135 text

More Ideas!

Slide 136

Slide 136 text

Ruby LSP Rails https://github.com/Shopify/ruby-lsp-rails

Slide 137

Slide 137 text

Language Server Hacks

Slide 138

Slide 138 text

App Must Be Running

Slide 139

Slide 139 text

Fetching Active Record Columns Check that the constant inherits from Active Record if token && token =~ /^[A-Z]/ begin const = Object.const_get(token) value = "# #{const.name}\n" if const < ActiveRecord::Base name_header = "Column Name" type_header = "Column Type" info = [[name_header, type_header]] + const.columns.map { |column| ["`" + column.name.to_s + "`", column.type.to_s] } max_name_len = info.map(&:first).sort_by(&:length).last.length max_type_len = info.map(&:last).sort_by(&:length).last.length name_header, type_header = *info.shift value << ("| " + name_header.ljust(max_name_len)) value << (" | " + type_header.ljust(max_type_len) + " |\n") value << ("| " + ("-" * max_name_len)) value << (" | " + ("-" * max_type_len) + " |\n") info.each do |name, type| value << ("| " + name.ljust(max_name_len)) value << (" | " + type.ljust(max_type_len) + " |\n") end end rescue NameError end end

Slide 140

Slide 140 text

Fetching Active Record Columns Check that the constant inherits from Active Record if token && token =~ /^[A-Z]/ begin const = Object.const_get(token) value = "# #{const.name}\n" if const < ActiveRecord::Base name_header = "Column Name" type_header = "Column Type" info = [[name_header, type_header]] + const.columns.map { |column| ["`" + column.name.to_s + "`", column.type.to_s] } max_name_len = info.map(&:first).sort_by(&:length).last.length max_type_len = info.map(&:last).sort_by(&:length).last.length name_header, type_header = *info.shift value << ("| " + name_header.ljust(max_name_len)) value << (" | " + type_header.ljust(max_type_len) + " |\n") value << ("| " + ("-" * max_name_len)) value << (" | " + ("-" * max_type_len) + " |\n") info.each do |name, type| value << ("| " + name.ljust(max_name_len)) value << (" | " + type.ljust(max_type_len) + " |\n") end end rescue NameError end end

Slide 141

Slide 141 text

Fetching Active Record Columns Check that the constant inherits from Active Record if token && token =~ /^[A-Z]/ begin const = Object.const_get(token) value = "# #{const.name}\n" if const < ActiveRecord::Base name_header = "Column Name" type_header = "Column Type" info = [[name_header, type_header]] + const.columns.map { |column| ["`" + column.name.to_s + "`", column.type.to_s] } max_name_len = info.map(&:first).sort_by(&:length).last.length max_type_len = info.map(&:last).sort_by(&:length).last.length name_header, type_header = *info.shift value << ("| " + name_header.ljust(max_name_len)) value << (" | " + type_header.ljust(max_type_len) + " |\n") value << ("| " + ("-" * max_name_len)) value << (" | " + ("-" * max_type_len) + " |\n") info.each do |name, type| value << ("| " + name.ljust(max_name_len)) value << (" | " + type.ljust(max_type_len) + " |\n") end end rescue NameError end end

Slide 142

Slide 142 text

URL Helper Information “rake routes” already knows this info! value = '' if token && token =~ /^([a-z_]+)(_path|_url)$/ # check if it's a route helper if Rails.application.routes.named_routes.key?($1) route = Rails.application.routes.named_routes.get($1) controller = route.requirements[:controller] action = route.requirements[:action] value = "* URI Pattern: `#{route.path.spec}`\n* Controller#Action: `#{controller} ##{action}`" else value = "Something else" end else # Other Stuff end

Slide 143

Slide 143 text

URL Helper Information “rake routes” already knows this info! value = '' if token && token =~ /^([a-z_]+)(_path|_url)$/ # check if it's a route helper if Rails.application.routes.named_routes.key?($1) route = Rails.application.routes.named_routes.get($1) controller = route.requirements[:controller] action = route.requirements[:action] value = "* URI Pattern: `#{route.path.spec}`\n* Controller#Action: `#{controller} ##{action}`" else value = "Something else" end else # Other Stuff end

Slide 144

Slide 144 text

URL Helper Information “rake routes” already knows this info! value = '' if token && token =~ /^([a-z_]+)(_path|_url)$/ # check if it's a route helper if Rails.application.routes.named_routes.key?($1) route = Rails.application.routes.named_routes.get($1) controller = route.requirements[:controller] action = route.requirements[:action] value = "* URI Pattern: `#{route.path.spec}`\n* Controller#Action: `#{controller} ##{action}`" else value = "Something else" end else # Other Stuff end

Slide 145

Slide 145 text

Helper Definitions

Slide 146

Slide 146 text

No content

Slide 147

Slide 147 text

Route Source Location bin/rails routes -E [aaron@tc-lan-adapter㷊 ~/g/blogsite (main)]$ bin/rails routes -E --[ Route 1 ]-------------------------- Prefix | users Verb | GET URI | /users(.:format) Controller#Action | users#index Source Location | config/routes.rb:6 --[ Route 2 ]-------------------------- Prefix | Verb | POST URI | /users(.:format) Controller#Action | users#create Source Location | config/routes.rb:6 --[ Route 3 ]-------------------------- Prefix | new_user Verb | GET URI | /users/new(.:format) Controller#Action | users#new Source Location | config/routes.rb:6 Rails 7.1!

Slide 148

Slide 148 text

Route Source Location Language Server Lookup if Rails.application.routes.named_routes.key?($1) route = Rails.application.routes.named_routes.get($1) file, line = route.source_location.split(':') file = File.join(@root, file) char = File.readlines(file)[line.to_i - 1].index(/[^\s]/) uri = "file://" + file result = { :uri => uri, :range => { start: { line: line.to_i - 1, character: char }, end: { line: line.to_i, character: 0 } } } writer.write(id: request[:id], result: result) end Find the source line Figure out the column Send info back to editor

Slide 149

Slide 149 text

Error Information

Slide 150

Slide 150 text

ERB is converted to Ruby Exceptions in the generated code must be mapped to the source

<%= notice %>

Users

<% @users.each do |user| %> <%= render user %>

<%= link_to "Show this user", user %>

<% end %>
<%= link_to "New user", new_user_path %> Source ERB #coding:ASCII-8BIT _erbout = +''; _erbout.<< "

".freeze; _erbout.<<(( notice ).to_s); _erbout.<< "

\n\n

Users h1>\n\n
\n ".freeze ; @users.each do |user| ; _erbout.<< "\n ".freeze ; _erbout.<<(( render user ).to_s); _erbout.<< "\n

\n ".freeze ; _erbout.<<(( link_to "Show this user", user ).to_s); _erbout.<< "\n

\n ".freeze ; end ; _erbout.<< "\n
\n\n".freeze ; _erbout.<<(( link_to "New user", new_user_path ).to_s); _erbout.<< "\n".freeze ; _erbout Evaluated Ruby

Slide 151

Slide 151 text

No content

Slide 152

Slide 152 text

No content

Slide 153

Slide 153 text

No content

Slide 154

Slide 154 text

No content

Slide 155

Slide 155 text

No content

Slide 156

Slide 156 text

Thank you Mame!

Slide 157

Slide 157 text

No content

Slide 158

Slide 158 text

Language Server Integration Simply Monkey Patch Rails! (Sorry Eileen) class ActionDispatch::DebugView def send_exception ex resp = { uri: "file://" + ex.file_name, diagnostics: [ "range" => { "start" => { "character" => 0, "line" => (ex.line_number.to_i - 1) }, "end" => { "character" => 65536, "line" => (ex.line_number.to_i - 1) }, }, "severity" => 1, "message" => ex.message ] } Refreshing::LSP::ERROR_QUEUE << [:error, resp] end end

Slide 159

Slide 159 text

Language Server Integration Cont. Pop off the queue and send to the editor Thread.new do while item = ERROR_QUEUE.pop type, val = *item if type == :clear subscriber.files.each do |file, version| val = { uri: file, version: version, diagnostics: [] } writer.write(method: "textDocument/publishDiagnostics", params: val) end else val[:version] = subscriber.files[val[:uri]] writer.write(method: "textDocument/publishDiagnostics", params: val) end end end

Slide 160

Slide 160 text

This is a Rube Goldberg Machine Ruby Goldberg?

Slide 161

Slide 161 text

My Pitch.

Slide 162

Slide 162 text

No content

Slide 163

Slide 163 text

Different Servers Have Different Features

Slide 164

Slide 164 text

No content

Slide 165

Slide 165 text

No content

Slide 166

Slide 166 text

Rails Should Include a Language Server

Slide 167

Slide 167 text

Only One

Slide 168

Slide 168 text

I might not value my time, but I highly value yours

Slide 169

Slide 169 text

Thank You!

Slide 170

Slide 170 text

Increased Creativity!

Slide 171

Slide 171 text

Thank You! 㷉