Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as os from 'os'
import * as fs from 'fs'
import { Logging } from '@aws/language-server-runtimes/server-interface'
import { FileContext } from '../../../shared/codeWhispererService'
import typedCoefficients = require('./coefficients.json')
Expand Down Expand Up @@ -292,6 +293,43 @@ export const autoTrigger = (
const r = sigmoid(classifierResult)
const shouldTrigger = r > TRIGGER_THRESHOLD

logging.log(`@@autotrigger@@
version: Postflare
classifierResult: ${r}
triggerChar: ${char}

Coefficient Contributions:
lengthOfRight: ${coefficients.lengthOfRightCoefficient * normalize(lengthOfRight, 'lenRight')},
lengthOfLeftCurrent: ${coefficients.lengthOfLeftCurrentCoefficient * normalize(lengthOfLeftCurrent, 'lenLeftCur')},
lengthOfLeftPrev: ${coefficients.lengthOfLeftPrevCoefficient * normalize(lengthOfLeftPrev, 'lenLeftPrev')},
lineNum: ${coefficients.lineNumCoefficient * normalize(lineNum, 'lineNum')},
osCoefficient: ${osCoefficient},
triggerType: ${triggerTypeCoefficient},
char: ${charCoefficient},
keyWord: ${keyWordCoefficient},
ide: ${ideCoefficient},
intercept: ${coefficients.intercept},
previousDecision: ${previousDecisionCoefficient},
language: ${languageCoefficient},
leftContextLength: ${leftContextLengthCoefficient}
--------------------------------------------------------------
lengthOfRight = ${coefficients.lengthOfRightCoefficient} * ${normalize(lengthOfRight, 'lenRight')};
lengthOfLeftCurrent = ${coefficients.lengthOfLeftCurrentCoefficient} * ${normalize(lengthOfLeftCurrent, 'lenLeftCur')};
lengthOfLeftPrev = ${coefficients.lengthOfLeftPrevCoefficient} * ${normalize(lengthOfLeftPrev, 'lenLeftPrev')};
---------------------------------------------------------------
`)

logging.log(`
right context (length=${fileContext.rightFileContent.length})
${fileContext.rightFileContent}
***************************************
left current context (length=${leftContextLines[leftContextLines.length - 1].length})
${leftContextLines[leftContextLines.length - 1]}
***************************************
left prev context (length=${leftContextLines[leftContextLines.length - 2].length})
${leftContextLines[leftContextLines.length - 2]}
***************************************`)

return {
shouldTrigger,
classifierResult: r,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ClientFileContextClss, FileContext } from '../../../shared/codeWhispere
import { CursorTracker } from '../tracker/cursorTracker'
import { RecentEditTracker } from '../tracker/codeEditTracker'
import { EditPredictionConfigManager } from './editPredictionConfig'
import { CodeWhispererSupplementalContext } from '../../../shared/models/model'
import { CodeWhispererSupplementalContext, CodeWhispererSupplementalContextItem } from '../../../shared/models/model'
import { UserTriggerDecision } from '../session/sessionManager'
import { Logging } from '@aws/language-server-runtimes/server-interface'
import { lastTokenFromString } from '../utils/triggerUtils'
Expand Down Expand Up @@ -343,19 +343,19 @@ ${JSON.stringify(
const editHistory = oldest ? EditClassifier.processEditHistory(oldest.content) : undefined
const normalizedEditHistory = editHistory ? EditClassifier.normalizedRecentEdit(editHistory) : undefined

this.logging.log(`lastLineFileContext:
${params.fileContext.leftContextAtCurLine}
recent decisions:
${JSON.stringify(params.recentDecisions)}
recent edits:
@@raw oldest edit@@
${oldest.content}
@@raw numbers@@
${JSON.stringify(editHistory, undefined, 2)}
@@normalized numbers@@
${JSON.stringify(normalizedEditHistory, undefined, 2)}
@@edits array@@
${params.recentEdits.supplementalContextItems.map(it => it.content)}`)
// this.logging.log(`lastLineFileContext:
// ${params.fileContext.leftContextAtCurLine}
// recent decisions:
// ${JSON.stringify(params.recentDecisions)}
// recent edits:
// @@raw oldest edit@@
// ${oldest?.content}
// @@raw numbers@@
// ${JSON.stringify(editHistory, undefined, 2)}
// @@normalized numbers@@
// ${JSON.stringify(normalizedEditHistory, undefined, 2)}
// @@edits array@@
// ${params.recentEdits.supplementalContextItems.map(it => it.content)}`)

// 6. Language
const lang = params.fileContext.programmingLanguage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ export class InlineCompletionHandler {
: undefined,
nextToken: `${params.partialResultToken}`,
})
this.logging.info(
`[inline completion] pulled subsequent pages with pagination token ${params.partialResultToken}; number of suggestion ${suggestionResponse.suggestions.length}`
)
return await this.processSuggestionResponse(
suggestionResponse,
currentSession,
Expand Down
Loading