Status Update
Comments
ko...@gmail.com <ko...@gmail.com> #2
sgtm, we can add the same API for FileSpec:
I recommend using github for a small checkout size:
Looks like we do have kotlin poet in the repo:
So just need to add it as an API dependency to the room-compiler-processing's build file.
If you can add a test to the generated code match test, that would be great:
lmk if you hit any blocker in getting started, thanks!
st...@gmail.com <st...@gmail.com> #3
Branch: androidx-main
commit 4a2360456d817b3101f289aac55ea1f3f610cfef
Author: Gabriel Freitas Vasconcelos <gfreivasc@gmail.com>
Date: Thu Mar 11 14:54:53 2021
[GH] Adds KotlinPoet integration to Room Processing
## Proposed Changes
Adds `write()` method that accepts KotlinPoet's an instance of
`FileSpec`. Also adds KotlinPoet as an API dependency and an extension
function similar to that of JavaPoet.
## Testing
Test: ./gradlew test connectedCheck without benchmarks
## Fixes
Fixes: [
This is an imported pull request from
Resolves #137
Github-Pr-Head-Sha: 96dc315b7e0e417e6a5e3d8cd6a8adda5c1b6c6a
GitOrigin-RevId: c5e4de3ab28fed968982e572c47b5ff07d210af7
Change-Id: I9d3aaa0a752447d9ba3978ce3fb705c0e74b3d13
M room/compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/CompilationResultSubject.kt
M room/compiler-processing-testing/src/main/java/androidx/room/compiler/processing/util/Source.kt
M room/compiler-processing-testing/src/test/java/androidx/room/compiler/processing/util/GeneratedCodeMatchTest.kt
M room/compiler-processing/build.gradle
M room/compiler-processing/src/main/java/androidx/room/compiler/processing/XFiler.kt
M room/compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacFiler.kt
M room/compiler-processing/src/main/java/androidx/room/compiler/processing/javac/JavacProcessingEnv.kt
M room/compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspFiler.kt
M room/compiler/src/test/kotlin/androidx/room/testing/test_util.kt
ko...@gmail.com <ko...@gmail.com> #4
All
ma...@umich.edu <ma...@umich.edu> #5
se...@bridgetek.com <se...@bridgetek.com> #6
Here is the code I've been using to periodically check if it is working yet..
function displayHighlightedCells() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sht = ss.getSheetByName("Sheet1");
Browser.msgBox("Range " + sht.getActiveRange().getA1Notation() + " selected.");
}
function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var entries = [
{
name : "Show Highlighted Cell Range",
functionName : "displayHighlightedCells"
}];
sheet.addMenu("Range Test", entries);
};
da...@gmail.com <da...@gmail.com> #7
And also this issue here..
Please star all items and have your friends star. We need to get Google to address this issue.
mi...@gmail.com <mi...@gmail.com> #8
[Deleted User] <[Deleted User]> #9
[Deleted User] <[Deleted User]> #10
function sendEmail(){
var emailAddress = 'mail@gmail.mx';
var message = "Message";
var subject = "Subject";
MailApp.sendEmail(emailAddress, subject, message);
}
jo...@gmail.com <jo...@gmail.com> #11
function onChangeInstallable(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var activeSheet = ss.getActiveSheet();
var activeSheetName = activeSheet.getSheetName();
if (activeSheetName == "Settings") {
if(e.changeType == "OTHER"){
// makes it this far ok but following line returns
// #REF! instead of A1 notation of changed cell.
var editedRange = SpreadsheetApp.getActiveRange().getA1Notation();
if (editedRange == 'B43' || editedRange == 'B44'){
setBackgroundColors();
}
}
}
}
ko...@gmail.com <ko...@gmail.com> #12
sa...@cloudreach.com <sa...@cloudreach.com> #13
I am trying to use this same function but it appears, it hasn't been fixed yet.
function onChangeInstallable(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var activeSheet = ss.getActiveSheet();
var activeSheetName = activeSheet.getSheetName();
if (activeSheetName == "Settings") {
if(e.changeType == "OTHER"){
// makes it this far ok but following line returns
// #REF! instead of A1 notation of changed cell.
var editedRange = SpreadsheetApp.getActiveRange().getA1Notation();
if (editedRange == 'B43' || editedRange == 'B44'){
setBackgroundColors();
}
}
}
I can't get neither the values of an Active Range using (SpreadsheetApp.getActiveRange().getValues()) nor the A1 Notation of the range when the onChange event type is OTHER.
This issue isn't fixed, I am sorry.
wa...@gmail.com <wa...@gmail.com> #14
da...@nppreklam.se <da...@nppreklam.se> #15
function onChange(e) {
if( e.changeType == 'INSERT_ROW' ) {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sh = spreadsheet.getSheetByName("SOMESHEETNAMEHERE");
var theRow = sh.getActiveRange().getRow();
Browser.msgBox("Range " + theRow + " selected.");
}
}
theRow will be the number of the row inserted.
wa...@gmail.com <wa...@gmail.com> #16
ek...@google.com <ek...@google.com>
jp...@gmail.com <jp...@gmail.com> #17
Here is what i'm trying to do and the sample code.
I want to run some script when a user unhides rows. The only way, that I can see, to detect when a user unhides rows is within the onChange event. The only way, that I can see, to try and determine what changed is through the changeType property. However, when a user unhides rows, the changeType is equal to OTHER. OTHER can mean all kinds of things. So I'd like to try and determine if rows were unhidden.
What I noticed is that when I unhide rows, those rows are now selected (have focus). So in theory, I should just be able to use getActiveRange() to return the rows that were just unhidden.
The problem is that when I use getActiveRange within the onChange event, it returns nothing. However, if I call getActiveRange after the onChange event function code has completed, then I get the correct information...even though I have not changed what I have currently selected in the sheet.
Why is getRange() returning nothing while within the onChange event?
The following onChange code will show a dialog box with the number of rows that is returned by the getActiveRange method when the user unhides rows. The code will add a menu item called Plan -> Test. Clicking Test will show a dialog box with the number of rows currently selected. To try this out, hide some rows, then unhide them. When you unhide them you will see a dialog box that says 0. Then go to Plan ->
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Plan')
.addItem('Collapse Section', 'collapseSection')
.addSeparator()
.addItem('Test','testThis')
.addToUi();
}
function testThis() {
var thisSheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var thisRange = thisSheet.getActiveRange();
popMsg(thisRange.getNumRows());
}
function onChange(e){
var activeSheet = e.source.getActiveSheet();
if (e.changeType == "OTHER") {
// some other event occurred, possible Unhiding Rows
if (activeSheet.getName() == "Portfolio") {
// only execute this code if the OTHER event occurred while on the Portfolio tab
var thisSheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var thisRange = thisSheet.getActiveRange();
popMsg(thisRange.getNumRows());
}
}
}
function popMsg (thisMsg) {
var ui = SpreadsheetApp.getUi();
var thisMsg = ui.alert('Information',thisMsg,ui.ButtonSet.OK);
}
ek...@google.com <ek...@google.com> #18
ik...@gmail.com <ik...@gmail.com> #21
function onChangeInstallable(e) {
var kaynak = e.source;
var aktif_sayfa = kaynak.getActiveSheet();
var aktif_sayfa_ismi = aktif_sayfa.getSheetName();
if (aktif_sayfa_ismi != "Flag List&Explanation") {
var aktif_hucrenin_degeri = SpreadsheetApp.getActiveRange().getValue();
console.log("Aktif Hücre'nin Değeri: " + aktif_hucrenin_degeri);
var aktif_hucrenin_karakter_sayisi = aktif_hucrenin_degeri.toString().length;
console.log("Aktif Hücre'nin Karakter Sayısı: " + aktif_hucrenin_karakter_sayisi)
if(e.changeType == 'FORMAT'){
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
var aktif_hucrenin_yolu = SpreadsheetApp.getActiveRange().getA1Notation();
console.log("Aktif Hücrenin Yolu: " + aktif_hucrenin_yolu);
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// SÜTUN YOLUNDAN SATIR NUMARASINI ALDIKTAN SONRA, SÜTUN'UN REFERANS HARFİNİ VE HARFİN KAÇINCI SIRAYA GELDİĞİNİ BULUYORUZ.
// Bunu yapmamızın nedeni Google Spreadsheet'in "onChange" fonksiyonunda aktif hücrenin yolunu bize sayısal sıraları olarak verememesinden kaynaklanıyor.
// Hücrelerin yolunu Sütün ve Satır olarak parçalara ayırırken çok fazla değişkenlik olduğundan ve içinden çıkılamaz hal alabileceğinden ötürü sadece A:Z arası Tek Harfli sütunlar için uyduladık.
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Numaraları Siler, Harfleri Korur. (HÜCRE YOLUNDAN SÜTUNU ALIYORUZ)
var sutun_yolu_harfi = aktif_hucrenin_yolu.replace(/\d+/g,'');
console.log("Aktif Sütun'un Harfi: " + sutun_yolu_harfi);
var sutun_yolu_numarasi = parseInt(sutun_yolu_harfi, 36) - 9;
console.log("Aktif Sütun'un İndex Numarası: " + sutun_yolu_numarasi);
// Harfleri Siler, Numaraları Korur. (HÜCRE YOLUNDAN SATIRI ALIYORUZ)
var satir_numarasi = aktif_hucrenin_yolu.toString().replace(/[^0-9\.]+/g, "");
console.log("Aktif Satır'ın İndex Numarası: " + satir_numarasi);
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if (sutun_yolu_numarasi == 9 && satir_numarasi > 1){
if (aktif_hucrenin_degeri == ""){
SpreadsheetApp.getUi().alert("Any empty cell's format cannot be changed in this field column.");
SpreadsheetApp.getActiveSheet().getRange(satir_numarasi, sutun_yolu_numarasi).setBackground(null).setFontColor('#000000');
return onChangeInstallable;
}
Description
Add onChange trigger to the spreadsheet code and try to obtain active range/cell location
What is the expected output? What do you see instead?
Active Range in A1 Notation
If possible, provide the code for a small sample script that reproduces the
issue:
onChange() { SpreadsheetApp.getActiveRange().getA1Notation() }
The result is always A1, no matter what part of the spreadsheet is selected.