Skip to content

Commit d7973b1

Browse files
committed
Disable AI lines of code until bugs fixed
1 parent ecba601 commit d7973b1

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed

lua/wakatime/init.lua

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ send_heartbeats = function()
776776
end
777777

778778
state.last_sent = now
779-
779+
780780
-- Clear line changes after sending
781781
state.ai_line_changes = {}
782782
state.human_line_changes = {}
@@ -820,12 +820,12 @@ append_heartbeat = function(file, now, is_write, last)
820820
heartbeat.lines = api.nvim_buf_line_count(0) -- Total lines in buffer
821821

822822
-- Add AI vs Human line changes
823-
if state.ai_line_changes[current_file] and state.ai_line_changes[current_file] ~= 0 then
824-
heartbeat.ai_line_changes = state.ai_line_changes[current_file]
825-
end
826-
if state.human_line_changes[current_file] and state.human_line_changes[current_file] ~= 0 then
827-
heartbeat.human_line_changes = state.human_line_changes[current_file]
828-
end
823+
-- if state.ai_line_changes[current_file] and state.ai_line_changes[current_file] ~= 0 then
824+
-- heartbeat.ai_line_changes = state.ai_line_changes[current_file]
825+
-- end
826+
-- if state.human_line_changes[current_file] and state.human_line_changes[current_file] ~= 0 then
827+
-- heartbeat.human_line_changes = state.human_line_changes[current_file]
828+
-- end
829829

830830
table.insert(state.heartbeats_buffer, heartbeat)
831831
set_last_heartbeat(now, now, current_file) -- Update last heartbeat time
@@ -1036,25 +1036,25 @@ update_line_numbers = function()
10361036
local doc = api.nvim_get_current_buf()
10371037
local file = get_current_file()
10381038
if not file or file == '' then return end
1039-
1039+
10401040
local current_lines = api.nvim_buf_line_count(doc)
1041-
1041+
10421042
-- Initialize line count for this file if not present
10431043
if not state.lines_in_files[file] then
10441044
state.lines_in_files[file] = current_lines
10451045
return
10461046
end
1047-
1047+
10481048
local prev_lines = state.lines_in_files[file]
10491049
local delta = current_lines - prev_lines
1050-
1050+
10511051
-- Track line changes based on AI state
10521052
if state.is_ai_code_generating then
10531053
state.ai_line_changes[file] = (state.ai_line_changes[file] or 0) + delta
10541054
else
10551055
state.human_line_changes[file] = (state.human_line_changes[file] or 0) + delta
10561056
end
1057-
1057+
10581058
-- Update current line count
10591059
state.lines_in_files[file] = current_lines
10601060
end
@@ -1065,12 +1065,12 @@ detect_ai_code_generation = function()
10651065
if vim.g.wakatime_ai_detected then
10661066
state.is_ai_code_generating = true
10671067
state.ai_debounce_count = state.ai_debounce_count + 1
1068-
1068+
10691069
-- Clear existing timer and set new one
10701070
if state.ai_debounce_timer then
10711071
vim.fn.timer_stop(state.ai_debounce_timer)
10721072
end
1073-
1073+
10741074
state.ai_debounce_timer = vim.fn.timer_start(1000, function()
10751075
if state.ai_debounce_count > 1 then
10761076
state.is_ai_code_generating = false

plugin/wakatime.vim

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ let s:VERSION = '11.3.0'
6565
let s:has_async_patch = has('patch-7.4-2344') || v:version >= 800
6666
let s:has_async = s:has_async_patch && exists('*job_start')
6767
let s:nvim_async = exists('*jobstart')
68-
68+
6969
" AI vs Human line change tracking
7070
let s:is_ai_code_generating = s:false
7171
let s:lines_in_files = {}
@@ -541,15 +541,15 @@ EOF
541541
let heartbeat.lineno = cursor[1]
542542
let heartbeat.cursorpos = cursor[2]
543543
let heartbeat.lines = line("$")
544-
544+
545545
" Add AI vs Human line changes
546-
if has_key(s:ai_line_changes, file) && s:ai_line_changes[file] != 0
547-
let heartbeat.ai_line_changes = s:ai_line_changes[file]
548-
endif
549-
if has_key(s:human_line_changes, file) && s:human_line_changes[file] != 0
550-
let heartbeat.human_line_changes = s:human_line_changes[file]
551-
endif
552-
546+
"if has_key(s:ai_line_changes, file) && s:ai_line_changes[file] != 0
547+
" let heartbeat.ai_line_changes = s:ai_line_changes[file]
548+
"endif
549+
"if has_key(s:human_line_changes, file) && s:human_line_changes[file] != 0
550+
" let heartbeat.human_line_changes = s:human_line_changes[file]
551+
"endif
552+
553553
let s:heartbeats_buffer = s:heartbeats_buffer + [heartbeat]
554554
call s:SetLastHeartbeat(a:now, a:now, file)
555555

@@ -691,7 +691,7 @@ EOF
691691
let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd]
692692

693693
let s:last_sent = localtime()
694-
694+
695695
" Clear line changes after sending
696696
let s:ai_line_changes = {}
697697
let s:human_line_changes = {}
@@ -849,11 +849,11 @@ EOF
849849
if !s:config_file_already_setup
850850
return
851851
endif
852-
852+
853853
" Update line numbers and detect AI code generation
854854
call s:UpdateLineNumbers()
855855
call s:DetectAICodeGeneration()
856-
856+
857857
let file = s:GetCurrentFile()
858858
if !empty(file) && file !~ "-MiniBufExplorer-" && file !~ "--NO NAME--" && file !~ "^term:"
859859
let last = s:GetLastHeartbeat()
@@ -1049,18 +1049,18 @@ EOF
10491049
if empty(file)
10501050
return
10511051
endif
1052-
1052+
10531053
let current_lines = line('$')
1054-
1054+
10551055
" Initialize line count for this file if not present
10561056
if !has_key(s:lines_in_files, file)
10571057
let s:lines_in_files[file] = current_lines
10581058
return
10591059
endif
1060-
1060+
10611061
let prev_lines = s:lines_in_files[file]
10621062
let delta = current_lines - prev_lines
1063-
1063+
10641064
" Track line changes based on AI state
10651065
if s:is_ai_code_generating
10661066
if !has_key(s:ai_line_changes, file)
@@ -1073,7 +1073,7 @@ EOF
10731073
endif
10741074
let s:human_line_changes[file] = s:human_line_changes[file] + delta
10751075
endif
1076-
1076+
10771077
" Update current line count
10781078
let s:lines_in_files[file] = current_lines
10791079
endfunction
@@ -1082,20 +1082,20 @@ EOF
10821082
" Simple heuristic: detect large pastes that might be AI-generated
10831083
let current_time = localtime()
10841084
let paste_threshold = 5 " lines
1085-
1085+
10861086
" Get recent change information from v:register or other sources
10871087
" This is a simplified detection mechanism
10881088
" In a real implementation, you might hook into specific AI tools
1089-
1089+
10901090
if exists('g:wakatime_ai_detected') && g:wakatime_ai_detected
10911091
let s:is_ai_code_generating = s:true
10921092
let s:ai_debounce_count = s:ai_debounce_count + 1
1093-
1093+
10941094
" Clear existing timer and set new one
10951095
if s:ai_debounce_timer != -1
10961096
call timer_stop(s:ai_debounce_timer)
10971097
endif
1098-
1098+
10991099
let s:ai_debounce_timer = timer_start(1000, function('s:StopAIDetection'))
11001100
endif
11011101
endfunction

0 commit comments

Comments
 (0)